Home › Forums › General discussion › Rules
- This topic has 9 replies, 2 voices, and was last updated 5 years, 6 months ago by Silvestre Kassoka.
-
AuthorPosts
-
-
May 31, 2019 at 16:08 #25532
Good day,
Excuse my elementary question, but i have a difficulty in having the form make calculations by setting up a rule. For example I have a rule that should divide a value by numbers of months to give a monthly value.
In the set Field Value i am make calculation, {Valor_x0020_Total_x0020_do_x0020}/{Number_x0020_of_x0020_Months}.
However the calculation is not happening rather the form displays the figures, as shown on print screen DFFS2.Attachments:
-
May 31, 2019 at 18:04 #25539
Hi,
You must prefix the value with calc:calc:{NumCol1}*{NumCol2}/{NumCol3}
Alexander
-
June 3, 2019 at 17:19 #25565
Hi Alexander,
Sorry to be coming back with this trivial issue , but i have prepdended the calc: as instructed but the results is still being shown as below
-
June 3, 2019 at 17:21 #25568
Sorry forgot print screen
Attachments:
-
June 3, 2019 at 18:59 #25571
Which version of DFFS are you running?
Alexander
-
June 4, 2019 at 10:31 #25581
We are using the below sated
DFFS Backend v4.4.1.2|CSS version: 4.16 / |spjs-utility version: 1.267 -
June 4, 2019 at 18:37 #25587
Ah, that explain it – this functionality was added in v4.4.3.0
This mean you must either update to a later version of DFFS, or use a custom function like this (change Your_field_internal_name to match the field you want to write to):
function doCalculation(){ var v1 = getFieldValue("Valor_x0020_Total_x0020_do_x0020"); var v2 = getFieldValue("Number_x0020_of_x0020_Months"); if(v1 !== "" && v2 !== ""){ var val = v1/v2; setFieldValue("Your_field_internal_name",val); } }
Put the function name doCalculation in the Run these functions / trigger these rules section in the rule.
Alexander
-
June 13, 2019 at 05:14 #25710
HI Alexander,
Sorry to not have come back earlier.However i tried the Custon Js and i am getting an error which i just cannot figure out. Please see the screen shots.Attachments:
-
June 14, 2019 at 16:07 #25741
You have a whitespace in front of the function name in the Run these functions field.
Alexander
-
June 20, 2019 at 00:27 #25820
Hi Akex,
Thanks a lot.I did as you suggested its working now.
-
-
AuthorPosts
- You must be logged in to reply to this topic.