I'm converting a report from Crystal Reports to SQL Server RS 2005, and I'm stuck on a multi-part, nested IF-THEN-ELSE structure that's necessary to display the data the user wants. I don't know if I'm trying to use too many nests, or if I can't keep track of the multiple ELSE's. Below is the statement as it exists in Crystal:
If anyone can suggest the best way to deal with this (keeping in mind I know very little about C# or VB.Net) I would greatly appreciate it.
Code:
IF {USER3} = "H"
THEN TOTEXT({USER3}) &
(IF({REPEAT_FLAG} = 0) THEN "N" ELSE "P") &
(IF({IMPORT_FLAG} = "T") THEN "I" ELSE "") &
(IF(ISNULL({CUSTOMIZATION_CODE})) THEN ""
ELSE {CUSTOMIZATION_CODE})
ELSE
(IF(ISNULL({USER3}))THEN ""
ELSE IF({USER3}IN ["O", "B", "W"])
THEN TOTEXT({USER3}) ELSE "") &
(IF({REPEAT_FLAG} = 0) THEN "N" ELSE "P" ) &
(IF({IMPORT_FLAG} = "T") THEN "I" ELSE "D") &
(IF(ISNULL({CUSTOMIZATION_CODE})) THEN ""
ELSE {CUSTOMIZATION_CODE})