• Resolved deivuga

    (@deivuga)


    Hi there,

    Having hard time to solve the commands;

    IF(fieldname6>=0,fieldname1,’97’)

    IF(fieldname6>=118.99,fieldname1,’137′)

    IF(fieldname6>=237.99,fieldname1,’142′)

    And so on,

    Putting a single line works, but when I want to add more options it doesn’t work or show at the fieldname1. Should there be some code that add > or =, but no more than next value 118.99 for example.

    Please advice,

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter deivuga

    (@deivuga)

    Hello, any chance to get comment?

    Plugin Author codepeople

    (@codepeople)

    Hello @deivuga

    My apologies for the delay, I did not receive the notification about your original entry.

    You have two alternatives. You can nesting “IF” conditional operations, or use “if” conditional statements. Please note JavaScript is case-sensitive language, uppercase and lowercase code matters.

    So, nesting “IF” operations the equation can be implemented as follows:

    
    IF(fieldname6<0, 97, IF(fieldname6<118.99, 137, IF(fieldname6<237.99, 142, fieldname1)))

    However, if the number of conditions grows, it is hard to understand and maintain the code.

    Another alternative is to use “if” conditional statements and implement the equation by using function strcuture:

    
    (function(){
    if(fieldname6 < 0) return 97;
    
    if(fieldname6 < 118.99) return 137;
    
    if(fieldname6 < 237.99) return 142;
    
    return fieldname1;
    })()

    Best regards.

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

The topic ‘IF’s’ is closed to new replies.