Rules

Home Forums General discussion Rules

Viewing 9 reply threads
  • Author
    Posts
    • #25532
      Silvestre Kassoka
      Participant

        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:
      • #25539
        Alexander Bautz
        Keymaster

          Hi,
          You must prefix the value with calc:

          calc:{NumCol1}*{NumCol2}/{NumCol3}

          Alexander

        • #25565
          Silvestre Kassoka
          Participant

            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

          • #25568
            Silvestre Kassoka
            Participant

              Sorry forgot print screen

              Attachments:
            • #25571
              Alexander Bautz
              Keymaster

                Which version of DFFS are you running?

                Alexander

              • #25581
                Silvestre Kassoka
                Participant

                  We are using the below sated
                  DFFS Backend v4.4.1.2|CSS version: 4.16 / |spjs-utility version: 1.267

                • #25587
                  Alexander Bautz
                  Keymaster

                    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

                  • #25710
                    Silvestre Kassoka
                    Participant

                      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.

                    • #25741
                      Alexander Bautz
                      Keymaster

                        You have a whitespace in front of the function name in the Run these functions field.

                        Alexander

                      • #25820
                        Silvestre Kassoka
                        Participant

                          Hi Akex,
                          Thanks a lot.I did as you suggested its working now.

                      Viewing 9 reply threads
                      • You must be logged in to reply to this topic.