Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If Then Else Statement

Status
Not open for further replies.

Khanson82

MIS
Mar 5, 2010
85
US
This should be easy but, when using this formula the other if then statements update properly, but for all blank values, I would think it would change them to "k", but it is not. The field is a string also.

if {Command.Requirement} = "a" then "a"
else if {Command.Requirement} = "b" then "b"
else if {Command.Requirement} = "c" then "c"
else if {Command.Requirement} = "d" then "d"
else if {Command.Requirement} = "e" then "e"
else if {Command.Requirement} = "f" then "f"
else if {Command.Requirement} = "g" then "g"
else if {Command.Requirement} = "h" then "h"
else if {Command.Requirement} = "i" then "i"
else if {Command.Requirement} = "j" then "j"
else "k"

Any suggestions?
 
They are not blanks but nulls, you need to deal with them first add this to beginning of your formula

if isnull({Command.Requirement}) then "k" else

Ian
 
Actually your formula is unneccesarily complex, this would do the same

if isnull({Command.Requirement}) then "k" else
{Command.Requirement}

or
if isnull({Command.Requirement}) then "k" else
if {Command.Requirement} in ["a", "b","c", ....] then
{Command.Requirement} else "k"

Ian
 
Or even simpler:

if isnull({Command.Requirement}) then
"k" else
if {Command.Requirement} in "a" to "j" then{Command.Requirement} else
"k"

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top