Focal Point
[SOLVED] FOC_NONE EXAMPLE

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

April 10, 2014, 08:48 AM
phoenixfox
[SOLVED] FOC_NONE EXAMPLE
Hello. Would anyone have an example of how FOC_NONE is used. I have the following and it is not working.

-*******SET clauses in the beginning of file***
-SET &DEPT = IF &DEPT EQ '' THEN 'FOC_NONE' ELSE '&DEPT';
-SET &COLL = IF &COLL EQ '' THEN 'FOC_NONE' ELSE '&COLL';
-SET &MAJOR = IF &MAJOR EQ '' THEN 'FOC_NONE' ELSE '&MAJOR';
-****end SET clauses

Then I have the following WHERE clauses:

-***WHERE clauses*******
WHERE (COLLEGE EQ '&COLL');
WHERE (DEPARTMENT_DESC EQ '&DEPT');
WHERE (MAJOR EQ '&MAJOR');
-****end WHERE clauses****

I checked the 5.3 documentation and that didn't answer my question. Thanks,

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 7.6
Windows, All Outputs
April 10, 2014, 09:04 AM
MichaelBalle
You haven't to test your field against 'FOC_NONE' but you have to postfix your WHERE statement with it:

-SET &TEST = 'T';
-SET &FN_TEXT = IF (&TEST EQ 'T') THEN 'FOC_NONE' ELSE '';

TABLE FILE CAR
SUM
DEALER_COST
RETAIL_COST
BY COUNTRY
BY CAR
BY MODEL

WHERE COUNTRY EQ 'ITALY' &FN_TEXT
END
-RUN


IF &TEST is eqaual to 'T' then &FN_TEXT is set to 'FOC_NONE' and ALL countries are displayed.

Setting &TEST to anything else, &FN_TEXT is empty and only cars with COUNTRY equal to ITALY are displayed.


WebFOCUS 7.6, 7.7
Windows, All Output formats
April 10, 2014, 11:25 AM
Danny-SRL
Phoenix,

You really shouldn't need the postfix. This has always worked fine for me:
  
-SET &ECHO=ALL;
-* File phoenix02.fex
-SET &COUNTRY='FOC_NONE';
TABLE FILE CAR 
SUM
DEALER_COST
RETAIL_COST
BY COUNTRY
BY CAR
WHERE COUNTRY EQ '&COUNTRY';
END



Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

April 10, 2014, 04:51 PM
phoenixfox
So Danny-SRL, if I try your method and leave the parm empty, I return all. But if I put a value in the parm, I return the filtered records, correct?

P


WebFOCUS 7.6
Windows, All Outputs
April 11, 2014, 02:54 AM
Danny-SRL
Phoenix,
quote:
if I try your method and leave the parm empty, I return all. But if I put a value in the parm, I return the filtered records

Right. If you want to use this method when passing parameters, then instead of
-SET &COUNTRY='FOC_NONE';
use
-DEFAULT &COUNTRY='FOC_NONE'
Then, if you do not pass a parameter, WF will use FOC_NONE, otherwise WF will use whatever you passed.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

April 11, 2014, 07:38 AM
Rifaz
Reason Daniel suggested to use -SET instead of -DEFAULT is that, when you're passing parameters, -DEFAULT overrides its value, -SET won't.


-Rifaz

WebFOCUS 7.7.x and 8.x
April 11, 2014, 08:41 AM
BGronli
quote:
-SET &DEPT = IF &DEPT EQ '' THEN 'FOC_NONE' ELSE '&DEPT';
-SET &COLL = IF &COLL EQ '' THEN 'FOC_NONE' ELSE '&COLL';
-SET &MAJOR = IF &MAJOR EQ '' THEN 'FOC_NONE' ELSE '&MAJOR';

My approach to this would be to put the where statement itself into a variable.
-SET &QT = '''' ;
-SET &WHRDEPT = IF &DEPT EQ '' THEN 'FOC_NONE' ELSE 'WHERE DEPARTMENT_DESC EQ '|&QT||&DEPT||&QT||';';
-SET &WHRCOLL = IF &COLL EQ '' THEN 'FOC_NONE' ELSE 'WHERE COLLEGE EQ '|&QT||&COLL||&QT||';'; 
-SET &WHRMAJOR = IF &MAJOR EQ '' THEN 'FOC_NONE' ELSE 'WHERE MAJOR EQ '|&QT||&MAJOR||&QT||';';  

Then, the where clause lines are
&WHRCOLL
&WHRDEPT
&WHRMAJOR  



7.7, z/OS & Win7, excel & pdf
8.2 testing
April 11, 2014, 09:01 AM
phoenixfox
Thanks for all the feedback. I'll try these out and see what works.

P


WebFOCUS 7.6
Windows, All Outputs
April 14, 2014, 05:36 AM
Wep5622
quote:
Originally posted by Rifaz:
Reason Daniel suggested to use -SET instead of -DEFAULT is that, when you're passing parameters, -DEFAULT overrides its value, -SET won't.


What makes you think -DEFAULT overrides parameter values?

@phoenixfox:
Looking at your code, that should just "work". Apparently you expect it to do something that it doesn't, so what did you expect to happen?

Or is your question specific to WF 5.3? In that case I wouldn't know, oldest I worked with was 7.6.8.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
April 15, 2014, 03:12 AM
Rifaz
[QUOTE]Originally posted by Wep5622:
What makes you think -DEFAULT overrides parameter values?
QUOTE]

Hi Wep5622,

Below fex made me to thought like that.. correct me if i'm wrong..

-*proc.fex

-DEFAULT &A='Test';
-TYPE A=&A

-SET &B='Test';
-TYPE B=&B  


Now, execute the file EX proc A=SampleDEF, B=SampleSET

o/p:
SampleDEF
Test


-Rifaz

WebFOCUS 7.7.x and 8.x
April 15, 2014, 03:14 AM
Rifaz
quote:
Originally posted by Wep5622:
What makes you think -DEFAULT overrides parameter values?


Hi Wep5622,

Below fex made me to thought like that.. correct me if i'm wrong..
-*proc.fex
-DEFAULT &A='Test';
-TYPE A=&A

-SET &B='Test';
-TYPE B=&B  

Now, execute the file EX proc A=SampleDEF, B=SampleSET
o/p:
SampleDEF
Test[/QUOTE]


-Rifaz

WebFOCUS 7.7.x and 8.x
April 15, 2014, 03:46 AM
Wep5622
That output is showing exactly the opposite of what you were claiming, doesn't it?:
-DEFAULT sets a default value that you overrode with the parameter you passed with the procedure (result is 'SampleDEF'), while -SET overrides your input parameter (result is 'Test') regardless of what you passed along for that parameter.

Perhaps you meant to claim that "-DEFAULT lets you override parameters, while -SET won't"?


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
April 15, 2014, 05:41 AM
Rifaz
yes Wep5622 you're correct, i was wrong in my first post. Thanks!!! you're a good tester. Wink


-Rifaz

WebFOCUS 7.7.x and 8.x
April 15, 2014, 06:35 AM
Wep5622
I know, IBI is going crazy over all the bug reports I opened :P


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
April 24, 2014, 12:22 PM
phoenixfox
I tried all the suggestions to the best of my ability and poster BGronli's worked. It's junky but it works. I'll go with it until I learn how and when to use the other methods. Thanks, P

This is done!


WebFOCUS 7.6
Windows, All Outputs
April 25, 2014, 10:39 AM
Kevin W
If it is done, don't foget to mark it [SOLVED]. This is explained at the top of the page under Tag Your Topic with Keywords.


WebFOCUS 7.7.05 (Someday 8)
Windows 7, All Outputs
In Focus since 1983.
April 25, 2014, 12:49 PM
Doug
Let's EVALuate, simplify, and remove the junky stuff from this, as follows (Try commenting out one of the -SETs):
-* File phoenix02.fex
-SET &COUNTRY='FOC_NONE';
-SET &COUNTRY='ENGLAND';
TABLE FILE CAR 
SUM
DEALER_COST
RETAIL_COST
BY COUNTRY
WHERE COUNTRY EQ '&COUNTRY.EVAL';
END





   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206