• Resolved hheyhey568

    (@hheyhey568)


    I have one calculated field having function which perform a complex do/while loop.

    Within this loop , I have 3 variables which are getting calculated.

    I want to show these 3 calculated variables into separate fields on form so that these 3 calculated variables are known to user.

    Is it possible?

    • This topic was modified 4 years, 9 months ago by hheyhey568.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @hheyhey568,

    Yes, that’s possible, one of the variables would be displayed in the calculated field where the equation is defined, and the other variables can be assigned to other fields in the form. I’ll try to describe the process with an hypothetical example:

    Assuming the current equation associated to the calculated field is:

    
    (function(){
        var A = fieldname1+fieldname2, 
            B = fieldname1*fieldname2,
            C = fieldname1-fieldname2;
       return A;
    })()
    

    Note: The previous equation is hypothetical.

    Now, assuming you want to assign the B variable to the fieldname123 field, and the C variable to the fieldname456 field, edit the previous equation as follows:

    
    (function(){
        var A = fieldname1+fieldname2, 
            B = fieldname1*fieldname2,
            C = fieldname1-fieldname2;
    
       getField(123).setVal(B); 
       getField(456).setVal(C);
    
       return A;
    })()
    

    The getField operation receive as parameter the numeric part of the field’s name, and return an object representation of the field.

    Best regards.

    Thread Starter hheyhey568

    (@hheyhey568)

    Thanks a lot, perfect.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘output to two fields using one calculated field’ is closed to new replies.