Can I put an if/then statement in a -SET variable?
I want to do:
-SET &ABCD = IF &RUNTIMEPROMPT EQ 'MD' THEN 'MARYLAND' ELSE '';
The resulting value of &ABCD would then be used in the WHERE clause of my query.
Is something like this possible in the -SET statement? Do I have the syntax wrong? Should I gather the variable in the -SET variable, then do the if/then translation as part of a DEFINE later in the code?
Any help would be appreciated.This message has been edited. Last edited by: <Kathryn Henning>,
Production - 7.6.4 Sandbox - 7.6.4
April 11, 2013, 04:03 PM
Rao D
Yes, You can put IF/THEN statement in -SET clause. and use that variable in where clause.
If your input is from variable it sounds good, if the INPUT value is from another field in the table then DEFINE will work.
WebFOCUS - ver8201 [ReportingServers: Windows 64bit; Client: tomcat and IIS on windows 2012 AppStudio
April 11, 2013, 08:22 PM
Jim Morrow
With -SET shown when the value of &RUNTIMEPROMPT is not MD the where predicate would become
WHERE EQ
which will thrown an error. Better to code
-SET &ABCD = IF &RUNTIMEPROMPT EQ 'MD' THEN 'WHERE EQ ''MARYLAND''' ELSE '';
Jim Morrow Web Focus 7.6.10 under Windows 2003 MVS 7.3.3
April 12, 2013, 02:24 PM
ColdWhiteMilk
quote:
-SET &ABCD = IF &RUNTIMEPROMPT EQ 'MD' THEN 'WHERE EQ ''MARYLAND''' ELSE '';
Thank you Jim. This is awesome, and is working perfectly for what I am trying to do