• Resolved Alwin

    (@wp-opti)


    I have a Calculated Field with this Equation (to calculate a price):
    PREC(MAX(10.20,fieldname6*0.34+3.40),2)

    I like to change this in:

    fieldname6+fieldname41+fieldname43 * 0.34+3.40

    so I did it like this:

    PREC(MAX(10.20,fieldname6+fieldname42+fieldname43*0.34+3.40),2)

    But somehow it does not work. What did I do wrong?

    Thank you,
    Alwin

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

    (@codepeople)

    Hello @wp-opti,

    The equation’s structure is correct, please, send me the link to the webpage where the form is inserted for checking the equation in action.

    Best regards.

    Thread Starter Alwin

    (@wp-opti)

    The link where the form is build is:
    https://loeka.optiion.nl/printen/

    The problem in this case is: from the 3 fieldnames 6,41 and 43 only one fieldname is actually used at a time.

    The other two fieldnames that are not used are set up with Predefined Value of 0 (zero).

    So the first thing to do in this form is make a choice in the first Radio Buttons box:
    – Liggend (landscape)
    – Staand (portrait)
    – Vierkant

    Now when the first option is selected then fieldname6 is displayed and fieldname41 and fieldname43 are not displayed.

    When the second option is selected then fieldname41 is displayed and fieldname6 and fieldname43 are not displayed.

    When the third option is selected then fieldname43 is displayed and fieldname6 and fieldname41 are not displayed.

    So let’s asume the first option is selected and the value of fieldname6 will be 40, and fieldname41 and 43 are both the Predefined Value of 0.

    Then 40+0+0 is 40 right?

    Plugin Author codepeople

    (@codepeople)

    Hello,

    As the fields: fieldname6, fieldname42 and fieldname43 are dependent, and only one would be active at the same time, the equation should be edited as follows:

    PREC(MAX(10.20,(fieldname6+fieldname42+fieldname43)*0.34+3.40),2)

    Best regards.

    Thread Starter Alwin

    (@wp-opti)

    That worked; thank you very much!

    Now I would like to add 2 final things.

    First:

    If the value/number of fieldname2 or fieldname41 or fieldname43 or fieldname44 is above 50 then a warning should be displayed in the Calculated field (instead of the calculated number).

    For this I came up with this code:

    IF(AND(50>=fieldname2,50>=fieldname41,50>=fieldname43,
    PREC(MAX(10.20,(fieldname6+fieldname42+fieldname43)*0.34+3.40),2), ‘Warning text’)

    Is this correct?

    Second:
    If the value/number of fieldname2 or fieldname41 or fieldname43 or fieldname44 is above 50 then the warning text should be displayed (like above) BUT the calculation should NOT be performend OR the result of the calculation should be 0 (zero).

    With calculation I mean this part:
    PREC(MAX(10.20,(fieldname6+fieldname42+fieldname43)*0.34+3.40),2)

    Is the second thing possible too?

    Thank you.

    Regards,
    Alwin

    Plugin Author codepeople

    (@codepeople)

    Hello @wp-opti,

    Please, take care of the parentheses in the equations, the open and close parentheses must match:

    
    IF(AND(50>=fieldname2,50>=fieldname41,50>=fieldname43),
    PREC(MAX(10.20,(fieldname6+fieldname42+fieldname43)*0.34+3.40),2), 'Warning text')
    

    I’m sorry, but I cannot implement your project, step by step as part of support. For implementing the users’ projects we offer a custom coding service.

    Best regards.

    Thread Starter Alwin

    (@wp-opti)

    I will ask for custom coding service this day!

    Thank you! ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Add fieldnames to Equation’ is closed to new replies.