• Resolved horizons66

    (@horizons66)


    Dear support, I am a new wordpress user. I’m trying to use the plugin for some calculated fields form and I’m testing with a simple subtraction operation. In the calculated field I inserted some dependencies, e.g.: if value is 1.5>=value && value<=1.649 if rule is valid show fieldname12, and so on. In the form I configured “image” fields that should appear depending on the resulting values of the calculated field. But in the form (which does the calculation exactly) I am shown all 4 images that I configured for a table of values. Where am I wrong? Sorry I’m a newbie

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

    (@codepeople)

    Hello @horizons66

    Thank you very much for using our plugin. Please provide the link to the page that contains the form to check your dependencies and the equation’s result.

    Best regards.

    Thread Starter horizons66

    (@horizons66)

    Hello @codepeople

    I haven’t published the page with the form yet. Can I send you the link with a private message to access the reserved area or I’ll make you a video and post it here? Thank you

    Thread Starter horizons66

    (@horizons66)

    Hi @codepeople

    this is a video captured from the page

    https://youtu.be/6l8FGWAeDVM

    Thank you!

    Plugin Author codepeople

    (@codepeople)

    Hello @horizons66

    Your equation does not require using the SUM operation. It can be implemented as fieldname2-fieldname6. I don’t know why you include a minus symbol in front SUM operation. But if you do it because the subtraction returns a negative number and want to make it positive, the correct would be using the ABS operation.

    ABS(fieldname2-fieldname6)

    Regarding the dependencies conditions issue, in JavaScript, the symbol for decimals is the point, not the comma. You can configure the fields to display commas as decimal separators, but in the code, you must use a valid symbol.

    So, the conditions would be:

    1.65 <= value
    1.55 <= value && value < 1.65
    1.40 <= value && value < 1.55

    Best regards.

    Thread Starter horizons66

    (@horizons66)

    thank you so much @codepeople!

    what if I don’t want any image to appear until all the fields involved in the operation are filled in?

    Plugin Author codepeople

    (@codepeople)

    Hello @horizons66

    In this case, you can check the fields values before evaluating the equation:

    IF(AND(fieldname2|r != '', fieldname6|r != ''), ABS(fieldname2-fieldname6), '')

    The plugin preprocesses the fields’ values to extract numbers to use in the mathematical operations. The |r modifier tells the plugin you want to access the field’s raw value instead of the preprocessed one.

    Best regards.

    Thread Starter horizons66

    (@horizons66)

    thanks @codepeople! One last piece of information: what if I didn’t want to display the field with the result of the calculation but only the button with the color? Thank you!

    Plugin Author codepeople

    (@codepeople)

    Hello @horizons66

    To hide the calculated field, you should only tick the “Hide field from public page” checkbox in its settings.

    Best regards.

    Thread Starter horizons66

    (@horizons66)

    thanks @codepeople!

    but the code you sent me previously (IF(AND(fieldname2|r != ”, fieldname6|r != ”), ABS(fieldname2-fieldname6), ”) doesn’t work. The red button remains (plus value lower closer to 0, because 0 is already displayed by default in the field before entering the data in the calculation field

    Plugin Author codepeople

    (@codepeople)

    Hello @horizons66

    I’m sorry, but it is hard to help you if I cannot check your dependencies.

    If you have a dependency that includes the zero value in the conditions, you must ensure the result is not empty. For example, assuming you want to display an element if the value is less than or equal to 1:

    value <= 1

    You can edit it as follows

    value <= 1 && value|r != ''

    Best regards.

    Thread Starter horizons66

    (@horizons66)

    Thanks again @codepeople. I will purchase a developer license because I need more features

    Thread Starter horizons66

    (@horizons66)

    hello @codepeople, I have to add another operation (+ 10.08) to this equation PREC (((fieldname4)* 1.8254),2,true) but every time I add + 10.08 to this equation, that number is displayed in the calculation field before all fields are filled in. Where am I wrong? Thank you

    Plugin Author codepeople

    (@codepeople)

    Hello @horizons66

    PREC must be the outermost operation in the equation because it will format the final result. So, the equation would be:

    PREC (fieldname4*1.8254+10.08, 2, true) 

    Best regards.

    Thread Starter horizons66

    (@horizons66)

    hello @codepeople, Thanks for the reply! What if the value of fieldname4 is a result of another equation on the same form? Because in the end nothing has changed, in the calculated field of the PREC equation (fieldname4*1.8254+10.08, 2, true) 10.08 is displayed by default, even if the final calculation is correct. It’s just a matter of visualization…..

    Plugin Author codepeople

    (@codepeople)

    Hello @horizons66

    If you want to add 10.08 only after evaluating fieldname4, you can use conditional operations in the equation:

    IF(fieldname4|r != '', PREC (fieldname4*1.8254+10.08, 2, true), '')

    Best regards.

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘calculated fields form: dependencies show image’ is closed to new replies.