• Resolved shaon007

    (@shaon007)


    Hi,

    I want to set some predefined result if the calculation result is more than expectation.

    For example:
    Our limit is +8, so if the result is more than that then result always will be +8.

    e.g.
    if result is +8 it should be +8
    if result is +9 it should be +8
    if result is +10 it should be +8
    if result is +7 it should be +7

    Can you please help?

    Thanks

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

    (@codepeople)

    Hello @shaon007

    You should simply to use the MIN operation.

    MIN(X,Y,Z) returns the minimum value between X,Y, or Z (or any other parameter passed to the operation).

    So, assuming the current equation is: fieldname1+fieldname2

    Edit it as follows:

    
    MIN(fieldname1+fieldname2, 8)
    

    and that’s all.
    Best regards.

    Thread Starter shaon007

    (@shaon007)

    Thanks for your reply.

    This is my equation

    IF(fieldname4<0.0,ROUND(fieldname4+(fieldname3/2)),ROUND(fieldname4-(fieldname3/2)))

    How do I use MIN() here?

    Plugin Author codepeople

    (@codepeople)

    Hello @shaon007

    
    MIN(8,IF(fieldname4<0,ROUND(fieldname4+fieldname3/2),ROUND(fieldname4-fieldname3/2)))
    

    Best regards.

    Thread Starter shaon007

    (@shaon007)

    Thanks sir

    Thread Starter shaon007

    (@shaon007)

    Another question sir..

    If your lower limit is +1.5 but the result comes out +1.0 then, how I will make it +1.5

    Plugin Author codepeople

    (@codepeople)

    Hello @shaon007

    In the same way you used the MIN operation, you should use the MAX one:

    
    MAX(1.5, MIN(8,IF(fieldname4<0,ROUND(fieldname4+fieldname3/2),ROUND(fieldname4-fieldname3/2))))
    

    Best regards.

    Thread Starter shaon007

    (@shaon007)

    That is working but we are still facing a problem.
    Actually we are building a “sphere cylinder spectacle calculator”

    we can divide the situation into 2 case:

    case 1:
    for negative number the limit is -6.0 to -1.5, so if the result is -7.0 then it will be -6.0 or if result is -1.0 then it will be -1.5

    case 2:
    for positive number the limit is +8.0 to +1.0, so if the result is +9.0 then it will be +8.0 or if result is +0.5 then it will be +1.0

    This is the actual scenario.

    Can you please help?

    Plugin Author codepeople

    (@codepeople)

    Hello,

    In this case you should move the MIN and MAX operations into the IF operation:

    
    IF(fieldname4<0,MIN(MAX(ROUND(fieldname4+fieldname3/2),-6),-1.5),MIN(MAX(ROUND(fieldname4-fieldname3/2), 1, 8)))
    

    I’m sorry, but the support service does not cover the implementation of the users’ projects (forms or formulas). If you need additional support to implement your proejct’s formulas, you can contact me through my private website: Customization

    Best regards.

    Thread Starter shaon007

    (@shaon007)

    Thanks sir for you quick reply and helping me. This will help me a lot.
    If I need any further implementation I will definitely ask for customization.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Predefined Result’ is closed to new replies.