• Resolved escribbles

    (@escribbles)


    Is it possible to use a variable as a predefined value in a calculated field?

    I am trying to make 1 calculator for multiple pages and would like to just use a variable on the page to insert the predefined value into the calculator to save considerable time. Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @escribbles

    You can insert a shortcode for the variable in the page’s content to define the new variable, for example:

    
    [CP_CALCULATED_FIELDS_VAR name="varname" value="myvalue"]
    

    and then, you can use this variable in the equations associated with the calculated fields in the form, for example: varname*2

    Best regards.

    Thread Starter escribbles

    (@escribbles)

    Yeah, the problem is I only want the variable as the predefined value of the calculated field. I would like to have another equation in there that changes dynamically with another editable calculated field.

    Plugin Author codepeople

    (@codepeople)

    Hello @escribbles

    The code depends on the equation. I’ll try to describe it with a hypothetical example.

    Assuming you have the equation: fieldname1+fieldname2, and you want to display the value of the variable while are not entered the values of these variables.

    The equation in this hypothetical case should be edited as follows:

    
    IF(OR(fieldname1,fieldname2), fieldname1+fieldname2, varname)
    

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Variable as Predifined Value’ is closed to new replies.