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     HELP - Dynamic WHERE clause

Read-Only Read-Only Topic
Go
Search
Notify
Tools
HELP - Dynamic WHERE clause
 Login/Join
 
<Wesley>
posted
I can't seem to create a dynamic WHERE clause with a SET variable.
Here is my code:

-SET &W_WHERE = IF &W_TYRE_ID EQ '1' AND &W_SORT_ID EQ '1' THEN 'WHERE D_LEVF_ID EQ '&D_LEVF_ID';';

To be used in:
TABLE FILE CSD_SLOB
SUM
&SUMX
BY &TYPE_SORT
ON TABLE COLUMN-TOTAL AS 'TOTAL'
&W_WHERE

If I use THEN 'WHERE D_LEVF_ID EQ '&D_LEVF_ID';';
then I the value for &D_LEVF_ID is shown and the set command works, but the actual WHERE clause gives the error:
(FOC257) MISSING QUOTE MARKS: 'WHERE D_LEVF_ID EQ
If I use THEN 'WHERE D_LEVF_ID EQ &D_LEVF_ID;';
then I get the error:
(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: &D_LEVF_ID

I can create the SUM and BY variably, but as soon as the SET VARIABLE enters the equation... no luck.
Anyone have any clues?

p.s. Only just started using WEBFOCUS, so please keep any ideas easy!! Big Grin
 
Report This Post
Master
posted Hide Post
Wesley
Try This to check your where! Hope it works for you. You can commet out the first 3 -SET I used them to test with.

-SET &W_TYRE_ID = '1';
-SET &W_SORT_ID = '1';
-SET &D_LEVF_ID = 'DIV';
-SET &W_WHERE = IF &W_TYRE_ID EQ '1' AND &W_SORT_ID EQ '1' THEN 'WHERE D_LEVF_ID EQ ''' | &D_LEVF_ID | ''';' ELSE '';
-TYPE &W_WHERE
-RUN
 
Posts: 865 | Registered: May 24, 2004Report This Post
<Wesley>
posted
Yeah, I was thinking along the same lines, but either one or the other didn't like it. After searching a little more, have found a solution, that isn't very good, but works:
-SET &W_WHERE = IF &W_TYRE_ID EQ '1' AND &W_SORT_ID EQ '1' THEN 'WHERE D_LEVF_ID EQ '| EDIT(&D_LEVF_ID) |' ; ' ;

Thanks for your help though - much appreciated.
 
Report This Post
<Pietro De Santis>
posted
Try this:

-SET &ECHO=ALL;

-SET &W_TYRE_ID = 1;
-SET &W_SORT_ID = 2;

-SET &D_LEVF_ID = 'XXX';

-SET &W_WHERE = IF &W_TYRE_ID EQ '1' AND &W_SORT_ID EQ '1' THEN 'WHERE D_LEVF_ID EQ ''&D_LEVF_ID.EVAL'';' ELSE '';

-TYPE &W_WHERE

You need double single quotes when embedding single-quotes within single-quotes!

Pietro.
 
Report This Post
Master
posted Hide Post
Also note that EQ is for evaluation and = is for assignment. Better to use = on the right hand side when you're assigning a value to the amper.
 
Posts: 919 | Registered: March 26, 2003Report 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     HELP - Dynamic WHERE clause

Copyright © 1996-2020 Information Builders