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] Variable listing values for use in multiple WHEREs

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Variable listing values for use in multiple WHEREs
 Login/Join
 
Member
posted
Is it possible to use a variable for a list for use in several WHEREs throughout a fex? If so, can somebody help me out with syntax?

Using "WHERE field IN ('value1','value2',...)" works, but if my fex needs to apply this WHERE to 4 tables, changing the values requires changing them in each WHERE line.

Using a FILEDEF with "WHERE field IN file" works also, but having to update/upload a file every time I want to change values is overkill and cumbersome.

Seems to me that it should be possible to define a variable at the top of the fex with whatever values, then just stick that variable in as many WHEREs as I need. But I can't get this to work and I'm not finding any answers in the help docs or existing forum posts.

-* =====A. This works=====
TABLE FILE CAR
SUM CNT.MODEL
BY COUNTRY
WHERE COUNTRY IN ('JAPAN','ITALY');
END
-*
TABLE FILE OTHERTBL
SUM CNT.FOO
BY COUNTRY
WHERE COUNTRY IN ('JAPAN','ITALY');
END

-* =====B. This works=====
FILEDEF CTRYLIST DISK Z:/WHATEVER/CTRYFILE.TXT
TABLE FILE CAR
SUM CNT.MODEL
BY COUNTRY
WHERE COUNTRY IN FILE CTRYLIST;
END
-*
TABLE FILE OTHERTBL
SUM CNT.FOO
BY COUNTRY
WHERE COUNTRY IN FILE CTRYLIST;
END

-* =====C. I want something like this but I can't get it to work=====
-SET &CTRYLIST=('JAPAN','ITALY');
TABLE FILE CAR
SUM CNT.MODEL
WHERE COUNTRY IN &CTRYLIST;
END
-*
TABLE FILE OTHERTBL
SUM CNT.FOO
WHERE COUNTRY IN &CTRYLIST;
END

This message has been edited. Last edited by: Kerry,


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 2 | Registered: November 23, 2010Report This Post
Expert
posted Hide Post
When providing values to Dialogue Manager variables that contain quotes, you need to include more quotes:

-SET &ECHO=ALL;

-SET &CTRYLIST = '(''JAPAN'',''ITALY'')';

TABLE FILE CAR
SUM CNT.MODEL
WHERE COUNTRY IN &CTRYLIST;
END

TABLE FILE OTHERTBL
SUM CNT.FOO
WHERE COUNTRY IN &CTRYLIST;
END
I'm not sure what the term for this is or where it's documented. You may be able to play with QUOTEDSTRING, but my suggestion is the easiest.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
-SET assigns a literal value, or a value that is computed in an arithmetic or logical expression, to a variable.

Single quotation marks around a literal value are optional unless it contains an embedded blank, comma, or equal sign, in which case you must include them.

The syntax is:

-SET &[&]name= {expression|value};

where:

&name - Is the name of a variable whose value will be set.

expression - Is a valid expression. Expressions can occupy several lines, so end the command with a semicolon.

value - Is a literal value assigned to the variable. If the literal value contains commas or embedded blanks, you must enclose the value in single quotation marks. If the value contains a single quote, place two single quotes where you want one to appear.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Member
posted Hide Post
Thank you! I put in more quotes like you said and it works now!


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 2 | Registered: November 23, 2010Report 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] Variable listing values for use in multiple WHEREs

Copyright © 1996-2020 Information Builders