Focal Point
[SOLVED] Variables with spaces in data

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1311074813

February 16, 2009, 10:54 AM
JonesGuy
[SOLVED] Variables with spaces in data
Hello all,

I am new to both WebFocus and the Forums and this is my first post. I am having an issue with data that contains spaces.

I am using Global Variables to go back and forth between many reports. I have an include file in each that sets the global variables based on the drill down that calls the report. By default all global variables have a value of FOC_NONE.

In the include I have this line of code
-SET &&DOWNED = IF '&DOWNED.EVAL' NE 'FOC_NONE' THEN ('''' | &DOWNED.EVAL | '''') ELSE &&DOWNED;

And in the .fex I refer to it in a where statement
WHERE OWNED_BY_CUST EQ &&DOWNED;

If &DOWNED contains a value of "JONES" (quotes not part of data)everything works fine. But if it has "R Jones" then it would fail and yield this error at the include statement.
(FOC261) EXPRESSION IS INCOMPLETE BECAUSE AN OPERATION IS MISSING

If it has "R-Jones" then it fails and returns this error.
(FOC281) ALPHA ARGUMENTS IN PLACE WHERE NUMERIC ARE CALLED FOR

I have tried various ways to set my include statement but haven't had any luck getting it to work. Any ideas?

Thanks,

Tim

edited solution
I used this syntax
-SET &&DOWNED = IF '&DOWNED.EVAL' NE 'FOC_NONE' THEN ('''' | '&DOWNED.EVAL' | '''') ELSE &&DOWNED;

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


WebFocus 7.610
WindowsXP
February 16, 2009, 11:03 AM
GinnyJakes
Welcome to the forum!

I personally don't use global variables in WF unless I absolutely have to but with that said, why don't you try looking up the QUOTEDSTRING modifier. There are a number of posts that reference it and you can also do the advanced search in the upper righthand corner.

Another aside is the fact that any line in your focexec with FOC_NONE in it is not parsed. Please take that into consideration when developing.

And lastly since I thought it was a requirement for new posters now but yours didn't seem to get updated, could you please go back and update your forum profile to include your product suite, releases, and platform so that we can better help you.

Hope this helps!


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
February 16, 2009, 03:27 PM
JonesGuy
Hello and thanks for the reply. I thought I filled out all the required fields. I am not sure what else to add to my sig. Is WFRS Report Server?

I think I may need a new approach. I used QUOTEDSTRING. I Changed my code to
-SET &&DOWNED = IF '&DOWNED.EVAL' NE 'FOC_NONE' THEN &DOWNED.QUOTEDSTRING ELSE &&DOWNED;

In turn I had to change my Where statements to
WHERE OWNED_BY_CUST EQ &&DOWNED.QUOTEDSTRING;

Now however when &&DOWNED = FOC_NONE the WHERE statement does not work correctly. I liked where I tried to Concatenate the quotes initially but the spaces really messed me up. Not to mention if I run into an apostrophe in my data. Is there a happy medium where I can set my global variable without having to use QUOTEDSTRING in my Where statement?

Thanks,

Tim


WebFocus 7.610
WindowsXP
February 16, 2009, 04:12 PM
FrankDutch
Tim

if you put your global variables in your startup file, it's not needed anymore to include them in each fex.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

February 17, 2009, 11:53 AM
susannah
As Ginny says, the FOC_NONE means the statement gets ignored. its a catch22.
so with quote-needy parms, i do this:

-*SET &FRED = FOC_NONE ;
-SET &FRED = 'R jones ' ;

-SET &filter = IF &FRED IS FOC_NONE THEN ' ' ELSE 'IF TVSTAR IS '''| &FRED ||'''';
-TYPE fred is &FRED
-TYPE filter is &filter

then in my fex, instead of
WHERE TVSTAR IS &FRED.QUOTEDSTRING

i use
&filter

and if i need more text on the same line, then
&filter.EVAL

and the results of this sample are:
 fred is R jones
 filter is IF TVSTAR IS 'R jones'

If i run it with SET &FRED = FOC_NONE
then i get
 fred is FOC_NONE
 filter is  





In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID