Link to home
Start Free TrialLog in
Avatar of Taras
TarasFlag for Canada

asked on

Check String for Null value and empty string""

I have a question for crystal Report.
If I want to check if field has null value or empty string “” in formula  how to do it properly?
Let say field has null value but I do not know it.

If I do check on this way:
 
if IsNull({somefield}) OR {Somefield} = ""  then
    Name:="A"
    Else
    Name:="B";
I will get value "A" if filed has null value.

But if I do this check on this way:
If {Somefield} = ""   OR  IsNull({somefield})  then
    Name:="A"
    Else
    Name:="B";
 I got not A not B as result when I put this formula in report. I got  just empty field I assume that formula returning null.

Why both ways not working and giving me same result “A” when filed has null value? I tried to use bracket but not help.

 And what if filed has some other not visible character in as Chr(10), Chr(13) Chr(9) … In first case will formula check if is not null and exit saying is not null and show me “B” and not go to check if filed has value empty string  ""??
ASKER CERTIFIED SOLUTION
Avatar of vasto
vasto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Taras

ASKER

Thanks a lot to all of you guys.