Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Concantenated Conditional WHERE Clause
Message
From
03/08/2006 10:16:05
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Concantenated Conditional WHERE Clause
Miscellaneous
Thread ID:
01142698
Message ID:
01142698
Views:
49
Trying to get a conditional WHERE clause to work in my SQL, but I can't seem to get the single/double quotes to work right. Basically, if the tPlans.PlanID = 7287, then I want to look at the web_PMEmp.ExecTitle field to determine the correct document name to match on. Any suggestions on another way to handle this welcome too.
PellaWhereClause = "AND IIF(tPlans.PlanID = 7287,'ALLTRIM(web_PlanDocs.cName) == IIF(web_PMEmp.ExecTitle = 'SA2','Plan Document - Executive SPP','Plan Document - Executive SPP')" + ",.T.)"

*-- Retrieve plan forms for all of the accounts the user is participating in	
     SELECT DISTINCT ;
          PADR(IIF(ALLTRIM(web_plandocs.cname) == 'PIN Form', "Plan Participant Web Access Form", web_plandocs.cname), 60) as cname, ;
          PADR(web_plandocs.mdesc, 250) as mdesc, ;
          web_plandocs.lscripted, ;
          web_plandocs.cfilename, ;
          web_plandocs.ntempltid, ;
          web_pmplan.planname, ;
          web_plandocs.planid ;
		FROM web_plandocs JOIN tplans ON tplans.planid = web_plandocs.planid ;
		JOIN web_pmplan ON web_pmplan.planid = web_plandocs.planid ;
		WHERE web_pmplan.nplancode = m.plancode ;
			AND web_plandocs.idnum = m.idnum ;
			AND web_plandocs.dtype = 1 &filter_PIN &PellaWhereClause ;
		ORDER BY web_pmplan.planname, web_pmplan.planid, web_plandocs.cname ;	
		INTO CURSOR tdoc
Next
Reply
Map
View

Click here to load this message in the networking platform