Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Variables inside Quotes
Go
New
Search
Notify
Tools
Reply
  
[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: 77 | Registered: December 29, 2009Reply With QuoteReport 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.05OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6104 | Location: Land of the Darug people, Terra Australis Incognita | Registered: October 31, 2006Reply With QuoteReport 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: 77 | Registered: December 29, 2009Reply With QuoteReport 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: 77 | Registered: December 29, 2009Reply With QuoteReport 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.05OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6104 | Location: Land of the Darug people, Terra Australis Incognita | Registered: October 31, 2006Reply With QuoteReport 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: 77 | Registered: December 29, 2009Reply With QuoteReport 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: 669 | Location: Veghel, The Netherlands | Registered: February 16, 2010Reply With QuoteReport 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, 2009Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Variables inside Quotes

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.