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] Variables inside Quotes

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Variables inside Quotes
 Login/Join
 
Gold member
posted
I'm trying to create this statement:

-SET &WHERE_DATE = IF &COMPARE EQ 'ON' THEN 'WHERE (DATE GE &STARTDATE AND DATE LE &ENDDATE) OR (DATE GE &STARTDATE2 AND DATE LE &ENDDATE2);' ELSE 'WHERE DATE GE &STARTDATE AND DATE LE &ENDDATE;';

However, with the single quotes, the varibles are being passed as literals and not replaced with the value sent from the procedure. I've toyed about with double-quote, some more singles, haven't figured it out yet.

Your help is appreciated.

This message has been edited. Last edited by: Joe Beydoun,


version 8202M
Reporting Server on
Windows Server using DB2 Connect to access data from iseries.
 
Posts: 78 | Registered: December 29, 2009Report This Post
Expert
posted Hide Post
You need to use the variables as fields and concatenate them to the string.

-SET &WHERE_DATE = IF &COMPARE EQ 'ON' THEN 'WHERE (DATE GE ' | &STARTDATE | ' AND DATE LE ' | &ENDDATE 
- | ') OR (DATE GE ' | &STARTDATE2 | ' AND DATE LE ' | &ENDDATE2 | ');' ELSE 'WHERE DATE GE ' | &STARTDATE 
- | ' AND DATE LE ' | &ENDDATE | ';';


The other option is to add .EVAL to the variables, but that can be dangerous, as if thevariable has an embedded quote, the line may fail.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Gold member
posted Hide Post
Thx for the response, I tried concatenation earlier and got this result from the parser:

-SET &WHERE_DTEI = IF ON EQ 'ON' THEN 'WHERE (ZHEDTEI GE ' | 20101201 | ' AND ZHEDTEI LE ' | 20101203 - | ') OR (ZHEDTEI GE ' | 20101206 | ' AND ZHEDTEI LE ' | 20101207 | ');' ELSE 'WHERE ZHEDTEI GE ' | 20101201 - | ' AND ZHEDTEI LE ' | 20101203 | ';';

(FOC260) AN OPERATION IS MISSING AN ARGUMENT


version 8202M
Reporting Server on
Windows Server using DB2 Connect to access data from iseries.
 
Posts: 78 | Registered: December 29, 2009Report This Post
Gold member
posted Hide Post
The .EVAL worked great, I would like to heed your warnings though, but this particular scenario "should" never see embedded quotes.

so help with the concatenation syntax would be appreciated.


version 8202M
Reporting Server on
Windows Server using DB2 Connect to access data from iseries.
 
Posts: 78 | Registered: December 29, 2009Report This Post
Expert
posted Hide Post
Is the -SET command on one line or three ?

The code I posted was on three lines.

The continuation character (first char) is a '-'.

In your post it is one line of code.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Gold member
posted Hide Post
Ok, I feel like a little grasshopper, I didn't even know about continuation characters.

Works great, thanks Waz.


version 8202M
Reporting Server on
Windows Server using DB2 Connect to access data from iseries.
 
Posts: 78 | Registered: December 29, 2009Report This Post
Master
posted Hide Post
Joe,

me too... Roll Eyes

don't feel bad, I've been looking for this also, couldn't find it either.

And it's impossible to find in de help. If it's there at all. ( should be in language documentation I think. )

Thanks Waz.


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 668 | Location: Veghel, The Netherlands | Registered: February 16, 2010Report This Post
Member
posted Hide Post
-SET &STARTDATE = &YYMD;
-SET &ENDDATE = &YYMD+5;
-SET &STARTDATE2 = &YYMD+10;
-SET &ENDDATE2 = &ENDDATE+10;
-SET &COMPARE = ON;
-TYPE &STARTDATE
-TYPE &ENDDATE
-TYPE &STARTDATE2
-TYPE &ENDDATE2

-SET &WHERE_DATE = IF &COMPARE NE 'ON' THEN 'WHERE DATE GE ''&STARTDATE.EVAL'' AND DATE LE ''&ENDDATE.EVAL'';'
-ELSE 'WHERE (DATE GE ''&STARTDATE.EVAL'' AND DATE LE ''&ENDDATE.EVAL'') OR (DATE GE ''&STARTDATE2.EVAL'' AND DATE LE ''&ENDDATE2.EVAL'');';
-TYPE &WHERE_DATE
-EXIT


WebFOCUS 7.1
Windows
HTML, PDF,Excel
 
Posts: 10 | Registered: February 25, 2009Report 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] Variables inside Quotes

Copyright © 1996-2020 Information Builders