if nested

Certified Associate Developer

Hi. I have a doubt in nested if's

here, if the first condition is true, then it will be return the statement "should be 18 digits". If it's false, I want null value to be returned. Since  I am using nested if's its returning "must be numerical and no more than 12no's". how can we resolve this. Can someone help me here?

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Associate Developer
    in reply to Mike Schmitt

    yes, adding to that When the second if condition is true I want null and when false "must be numerical and no more than 12 numbers" should be displayed.
    The problem with the above coding is, the second if is working as expected. But when the first if statement returns false, it's displaying "must be numerical and no more than  12 numbers" which  shouldn't. 
    Hope I explained the problem clearly

  • The problem with the above coding is, the second if is working as expected. But when the first if statement returns false

    This is not possible.  As I explained earlier, the second if() only ever executes when the top-level if() evaluates to FALSE.

    I suggest you review and get more familiar with the precedence in which nested if() statements execute.  Namely, that they execute stricly in order from the top-most level, and any nested expressions will only ever be evaluated when the parent condition evaluates in such a way as to call that particular child path (i.e. either the "true" path or the "false" path).