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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multi-part nested IIF statement problems

Status
Not open for further replies.

SQLHacker

MIS
Aug 10, 2006
45
US
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:
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})
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top