- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2016 02:14 PM
I have created the following in a calculated field to add the numerical contents of three fields:
var a = parseInt(g_form.getValue('current.u_currency'));
var b = parseInt(g_form.getValue('current.u_currency_3'));
var c = parseInt(g_form.getValue('current.u_currency_5'));
var d = a+b+c;
g_form.setValue('current.u_total_project_capex',d);
It returns 0. Any ideas?
Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2016 02:58 PM
Kari,
Here is your calculated value
if(!isNaN(current.u_currency) && !isNaN(current.u_currency_3) && !isNaN(current.u_currency_5)){
current.u_total_project_capex=(parseInt(current.u_currency)+parseInt(current.u_currency_3)+parseInt(current.u_currency_5)).toString();
}
Thanks,
Abhinay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2016 04:12 PM
Never underestimate the power of a good example on the system. In this case, sys_user.name is a good example of how crazy you can get with a calculated field. One would think it's simply first+last. Nope!
if (current.first_name.nil() && current.last_name.nil() && !current.name.nil()) {
var names = current.name.toString().split(" ");
if (names.length > 1) {
current.first_name = names[0];
names.shift();
current.last_name = names.join(" ");
} else
current.last_name = names[0];
}
if(current.first_name.nil()) {
current.last_name;
} else {
current.first_name + ' ' + current.last_name;
}
