Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] IF statement in -SET

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] IF statement in -SET
 Login/Join
 
Platinum Member
posted
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
 
Posts: 241 | Location: Bethesda, MD | Registered: August 14, 2007Report This Post
Platinum Member
posted Hide Post
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

 
Posts: 104 | Location: Indianapolis | Registered: November 08, 2007Report This Post
Platinum Member
posted Hide Post
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



 
Posts: 129 | Registered: June 01, 2005Report This Post
Platinum Member
posted Hide Post
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


Production - 7.6.4
Sandbox - 7.6.4
 
Posts: 241 | Location: Bethesda, MD | Registered: August 14, 2007Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] IF statement in -SET

Copyright © 1996-2020 Information Builders