• Resolved civilvicky

    (@civilvicky)


    Can you help me with formula.
    I want a formula for fieldname11. I have created a calculator form and I am stuck with a formula. I have shown an example and what a formula will look like. I have created formula for fieldname2,fieldname3 and stuck with fieldname11. can you please help me out.

    fieldname1 = 1,2,8 (values entered by user)

    fieldname11 = ((|1-fieldname3|)+(|2-fieldname3|)+(|8-fieldname3|))/ fieldname2

    The page I need help with: [log in to see the link]

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

    (@codepeople)

    Hello @civilvicky

    The equation in this case can be implemented as follows:

    SUM(ABS(1-fieldname3),ABS(2-fieldname3),ABS(8-fieldname3))/fieldname2

    Best regards.

    Thread Starter civilvicky

    (@civilvicky)

    The formula is not working properly.
    For example I used this values.

    Fieldname1 : 1,2,8,2,8
    fieldname2 : 5
    fieldname3 : 4.2
    The answer I am getting is:
    Fieldname12 : 1.8399999999999999

    But this is not correct answer. The correct answer would be:

    Average Deviation : (|1-4.2|)+(|2-4.2|)+(|8-4.2|)+(|2-4.2|)+(|8-4.2|) / 5
    Average Deviation : (|-3.2|)+(|-2.2|)+(|3.8|)+(|-2.2|)+(|3.8|) / 5
    Average Deviation : (3.2)+(2.2)+(3.8)+(2.2)+(3.8) / 5
    Average Deviation : 15.2 / 5
    Average Deviation : 3.04

    Thread Starter civilvicky

    (@civilvicky)

    The values of the fieldname1 are entered by users. I have used some values just as example. Users can enter any values.

    Plugin Author codepeople

    (@codepeople)

    Hello @civilvicky

    You are describing a different situation.

    The fieldname1 values are multiple numbers separated by commas. So, you must split its components.

    In this case, the equation must be implemented as follows:

    (function(){
    var v = fieldname1|r.replace(/[^\d\.\,]/g, '').replace(/^\,+/, '').replace(/\,+$/, '').replace(/\,+/g,',').split(','), result = 0;
    
    for(var i in v){
    result += ABS(v[i]*1-fieldname3);
    }
    
    return PREC(result/fieldname2, 2, true);
    })()

    Best regards.

    Thread Starter civilvicky

    (@civilvicky)

    Thank You So Much. This really helped.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘formula help’ is closed to new replies.