- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2015 04:20 AM
Hi,
I want a field F1 in Incident table which will store the value (F2 * F3) where F3 can be decimal upto two decimals like 356.87.
What type F1 , F2 and F3 should be while creating is it String ?
Need business rule to store this value.
Can anyone suggest please
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2015 03:19 AM
function onSubmit()
{
var a = g_form.getValue('u_people_number'); //this field should contain whole numbers - decimal
var b = g_form.getValue('u_hours_on_swat'); // this field should contain decimal upto 3 digits.-decimal
var c = (a*b);
g_form.setValue('u_total_hours', c); // this field should store value of (a*b) -decimal
return true;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2015 05:22 AM
i tried client script as below for Incident table. But the field does not display the value. I cant see the result.Can anyone help why it does not show?
---------------------------------------------------------------------
function onSubmit()
{
var a = 356;
var b = 456.45 ;
var c = (356*456.45);
g_form.setValue('u_swat_hours', c);
}
---------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2015 05:32 AM
You mentioned it as business rule in the subject bat it looks like a client script from the code. If its a business rule then you cannot use g_form in there , use current instead . also change name of the function to onBefore() or onAfter() depending upon the type of BR .
If you are using a client script then try to alert variable c .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2015 01:27 AM
Actually i was first trying from BR then went for Client script. I was testing the code below. But not sure if all fields should be decimal or string.
__________________________
function onSubmit()
{
var a = g_form.getValue('u_people_number'); //this field should contain whole numbers
var b = g_form.getValue('u_hours_on_swat'); // this field should contain decimal upto 3 digits.
var c = (a*b);
g_form.setValue('u_total_hours', c); // this field should store value of (a*b)
return true;
}
_________________________
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2015 01:40 AM
The Code seems to be correct . the only issue may be with type of the variable . as Kalaiarasan P mentioned use decimal and it should work.