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
Hey,If you simply want to return null for false then instead of using second if, just replace it by null.
I need the second if too.
Can you tell what are you trying to check in the first and second and conditions?? you can try swapping the if conditions and check it out. It might help. it could be something likeif(
and(),
"must be numerical and no more than 12 numbers",
if(
"should be 18 digits",
{})
)
In those conditions I am checking the length of the field based on the input
try something like this
hema.mathivathanan said:I need the second if too.
But that's not what you said in your description.
with the above code, the second if is not working properly
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
You can try using not condition outside and or some other logic and achieve what you want
hema.mathivathanan said:the second if is not working properly
To be clear, the second if() will only ever execute when the first if() resolves to FALSE.
If this is not what you want to happen, then you will need to restructure your if() nesting to flow logically per what you want to happen.