• Resolved Francis

    (@emolotel)


    Is it possible to have this formula on a calculated field?

    Example :

    If (fieldname 1> 10% of fieldname 2) return 1;

    If (fieldname 1 <= 10% of fieldname 2) return 2;

    Thank you

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

    (@codepeople)

    Hello @emolotel

    Yes of course, however, you should know that javascript (the language supported by browsers) is case sensitive, so, you should to decide if implement the equation using the “IF” operation distributed with the plugin, or the “if” conditional statement of javascript.

    – Using the “IF” operation distributed with the plugin:

    
    IF(fieldname2*0.10<fieldname1, 1, 2)
    

    – Using the ternary operator of javascript:

    
    (fieldname2*0.10<fieldname1) ? 1 : 2
    

    – Using the conditional statement “if” and the function’s structure:

    
    (function(){
    if(fieldname2*0.10<fieldname1) return 1;
    return 2;
    })()
    

    The previous equations are all of them equivalents.

    Best regards.

    Thread Starter Francis

    (@emolotel)

    Thank you
    always timely and correct in the answers

    Hi there, I’ve been searching EVERYWHERE (Well…clearly not EVERYWHERE) to this type of thing. Where do I put these formulas? I mean, where exactly in WP do I write this (The: IF(fieldname2*0.10<fieldname1, 1, 2) )? Does it matter if the fields are in different “PODS”?

    ..and as a general rule, is writing a formula in PODS similar to Excel?

    Plugin Author codepeople

    (@codepeople)

    Hello @equitycreators

    If you insert a calculated field in the form and select it, you will see the field’s properties in the left bar. One of properties associated to the calculated fields is a textarea called “Set Equation”, this is the place where you should enter the equation to associate with the field.

    Please, look the screenshot below:

    Best regards.

    What about if the fiellds are in different PODS?…

    Plugin Author codepeople

    (@codepeople)

    Hello @equitycreators

    I’m sorry, but I don’t know what do you mean exactly.

    Best regards.

    Lets say Field 1 is in the POD “Assets”, Field 2 is in the POD “Liabilities” and Field 3 is in a POD called “People” and I need to calculate the difference between Field and Field 2 and populate it in Field 3.

    Plugin Author codepeople

    (@codepeople)

    Hello @equitycreators

    If you are referring to the PODs as “Portable Object Doclets”, I’m sorry, but our plugin does not manage these concepts. If you are referring to the sheets in a spreadsheet file, our plugin generate forms and not spreadsheet files, so, there are no sheets.

    Best regards.

    OMG…..you have no idea how much of an idiot I feel right now…I thought I was in the PODS support forum….take this as a compliment of your outstanding customer service not ignoring me, answering me quickly…even though I was speaking another language…Well Done!

    JA.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘calculate percentage of a field’ is closed to new replies.