• Resolved tvmimama

    (@tvmimama)


    Hello, I have a question, I need to assign a value to one field based on the value of two other fields.
    Let me explain, I have a numeric field which is the quantity whose maximum value is 25000 and then I have a time drop-down list with four values: 25, 37, 49 and 61.
    Depending on the quantity and value of time, I have to assign a value to a field and then use that field for a calculation.
    When assigning the value, the quantity field is divided into three sections: less than or equal to 2500, between 2501 and 5000 and greater than 5001.

    I summarize if the quantity is less than 2500 and the time is 25, a value is assigned, if the quantity is greater than 5001 and the time is 37, another value is assigned.

    It is as if you have a table with 3 columns for quantity and 4 rows for time and each cell has a different value to assign to another field to use in a calculation.

    Thank you

Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @tvmimama

    You simply should use conditional statements as part of the equations, for example (the values and fields’ names are hypothetical only to describe the process):

    
    (function(){
        if(fieldname1 <= 2500)
        {
    		if(fieldname2 == 25) return 12;
    		if(fieldname2 == 37) return 34;
    		if(fieldname2 == 49) return 56;
    		if(fieldname2 == 61) return 78;
        }
        else if(fieldname1 <= 5000)
        {
    		if(fieldname2 == 25) return 21;
    		if(fieldname2 == 37) return 43;
    		if(fieldname2 == 49) return 65;
    		if(fieldname2 == 61) return 87;
        }
        else
        {
    		if(fieldname2 == 25) return 23;
    		if(fieldname2 == 37) return 45;
    		if(fieldname2 == 49) return 67;
    		if(fieldname2 == 61) return 89;
        }
    })()
    

    If you need additional help to implement your project, we can offer you a custom coding service through our private website: Customization

    Best regars.

Viewing 1 replies (of 1 total)
  • The topic ‘help with formula’ is closed to new replies.