• Resolved kimbedi

    (@kimbedi)


    Hi

    I am trying to create a calculation but since the plugin update it no longer works.

    It was:

    (function(){

    if(fieldname1==”Top-Floor” && fieldname2==”2″) return 76;

    })();

    where both fieldname 1 and fieldname 2 are checkbox values

    It worked fine until I updated the plugin

    Any ideas what I need to change

    thanks

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

    (@codepeople)

    Hello @kimbedi,

    Could you send me the link to the webpage where was inserted the form for checking the issue in detail, please?

    Best regards.

    Thread Starter kimbedi

    (@kimbedi)

    Plugin Author codepeople

    (@codepeople)

    Hello @kimbedi,

    There is nothing wrong with your copy of the plugin, however, your equation is invalid.

    Your current equation is:

    (function () {
    	if (fieldname8 == "Top-Floor" && fieldname9 == "2")
    		return 76;
    	if (fieldname8 == "Middle-Floor")
    		return 81;
    	if (fieldname8 == 2.5)
    		return 81;
    	if (fieldname2 == 3)
    		return 89;
    	if (fieldname2 == 3.5)
    		return 97;
    	if (fieldname2 == 4)
    		return 105;
    	if (fieldname2 == 4.5)
    		return 113;
    	if (fieldname2 == 5)
    		return 121;
    })()

    But your form does not include any field with the name fieldname2, generating a parsing error when the plugin tries to replace the fields names by their values, and evaluate the equation.

    Best regards.

    Thread Starter kimbedi

    (@kimbedi)

    sorry that should be radio button values not checkbox values

    thanks

    Thread Starter kimbedi

    (@kimbedi)

    Doh

    sorry about that – had a brain freeze

    course that’s the issue

    thanks for all your help

    Plugin Author codepeople

    (@codepeople)

    Hello,

    I see you have fixed the equation and your form is working fine now.

    Best regards.

    Thread Starter kimbedi

    (@kimbedi)

    yes thanks – one last thing I hope.

    can you limit a number field to e.g. 1 or 2 decimal places?

    thanks again for all your help

    Plugin Author codepeople

    (@codepeople)

    Hello,

    Yes of course, you simply should use the “PREC” operation:

    PREC(X, Y) returns the number X rounded to Y decimal places.

    PREC(1.3546,3) = 1.355
    PREC(1.3546,2) = 1.35

    Best regards.

    Thread Starter kimbedi

    (@kimbedi)

    can’t seem to see the box in a number field where that goes?

    thanks

    Plugin Author codepeople

    (@codepeople)

    Hello,

    The operation is used in the equations, for rounding the result with X decimal places, but this feature is not included in the number fields.

    Best regards.

    Thread Starter kimbedi

    (@kimbedi)

    oh ok – thanks for all your help

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Calculated field’ is closed to new replies.