Focal Point
[SOLVED] Difference Between _Foc_Null and Foc_None

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

March 31, 2016, 04:49 PM
N/A
[SOLVED] Difference Between _Foc_Null and Foc_None
Hello,
If I do HTML document and use Ignore filter as FOC_NOne we get a different result when we use -FOC_NULL .
niha

This message has been edited. Last edited by: Kathleen Butler,


WebFOCUS 8
Windows 7
HTML
March 31, 2016, 04:55 PM
j.gross
FOC_NONE causes the line of code to be ignored, as if that line were blank. The line need not be a WHERE phrase -- for example, it can be employed to eliminate a BY clause or a verb object.

_FOC_NULL forces a WHERE condition to evaluate as "True", regardless of the incoming data values.

Now is the report's behavior clear?


- Jack Gross
WF through 8.1.05
March 31, 2016, 05:09 PM
N/A
hello,
We are trying to execute the following code to set report header but it is not working.
-IF '&ST_PROV_MXCSH_NA' EQ 'FOC_NONE' THEN GOTO ALLHDR;
-IF '&ST_PROV_MXCSH_NA' EQ '_FOC_NULL' THEN GOTO SUMMHDR;
-SET &RPT_HEADER = 'US TOTAL BY STATES';
-GOTO ENDHDR
-SUMMHDR
-SET &RPT_HEADER = 'US SUMMARY';
-GOTO ENDHDR
-ALLHDR
-SET &RPT_HEADER = 'US TOTAL ALL STATES';
-ENDHDR


THE FOLLOWING CODES WORKS FINE FOR THE REPORT
DEFINE FILE PVTFT001_COV_MO_FT ADD
ST_PROV_MXCSH_NA/A30=IF '&ST_PROV_MXCSH_NA' EQ '_FOC_NULL' THEN 'ALL' ELSE PVTFT001_COV_MO_FT.T8_PVTDM061_LOC_DM.ST_PROV_MXCSH_NA;
END
PLEASE SUGGEST
NP


WebFOCUS 8
Windows 7
HTML
April 01, 2016, 07:13 AM
Rifaz
Could you please tell us, what you're trying to achieve?
Go ahead and try toggle between
TABLE FILE CAR
PRINT COUNTRY
WHERE COUNTRY EQ '_FOC_NULL'
-*WHERE COUNTRY EQ 'FOC_NONE'
END



-Rifaz

WebFOCUS 7.7.x and 8.x
April 01, 2016, 07:53 AM
MartinY
I suppose that &ST_PROV_MXCSH_NA is a parameter which is provided by a portal control field meaning that value/option can be selected such as "US Summary", "US Total All States" and "US Total By States".

As a simple way I will have that control define as a radio with three options (same as above) and where each of them have its own returned value (where it could be 1 = "US Summary", 2 = "US Total All States" and 3 = "US Total By States".

According to this, your code become:
-IF &ST_PROV_MXCSH_NA EQ 1 THEN GOTO SUMMHDR;
-IF &ST_PROV_MXCSH_NA EQ 2 THEN GOTO ALLHDR;
-SET &RPT_HEADER = 'US TOTAL BY STATES';
-GOTO ENDHDR
-SUMMHDR
-SET &RPT_HEADER = 'US SUMMARY';
-GOTO ENDHDR
-ALLHDR
-SET &RPT_HEADER = 'US TOTAL ALL STATES';
-ENDHDR 

DEFINE FILE PVTFT001_COV_MO_FT ADD
ST_PROV_MXCSH_NA/A30=IF &ST_PROV_MXCSH_NA NE 3 THEN 'ALL' ELSE PVTFT001_COV_MO_FT.T8_PVTDM061_LOC_DM.ST_PROV_MXCSH_NA;
END



WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
April 01, 2016, 10:59 AM
eric.woerle
Because I have a tendency to focus on the wrong things...

Why are we using goto for this? the whole thing could be simplified into:

 
-SET &RPT_HEADER = IF &ST_PROV_MXCSH_NA EQ 1 THEN 'US SUMMARY'
- ELSE IF &ST_PROV_MXCSH_NA EQ 2 THEN 'US TOTAL ALL STATES'
- ELSE 'US TOTAL BY STATES'
 


You may now return to your regularly scheduled programming.


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
April 01, 2016, 11:08 AM
MartinY
In this case you are right Eric, the IF THEN ELSE will do the job.

But what if you would like to perform several actions according to each parameter's value ?
The GOTO may be the only solution...


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
April 01, 2016, 12:02 PM
eric.woerle
Thats assuming niha is doing multiple actions. I'm just going on what was presented in the example. That's all. Like I said... not really what the point of the thread is. Just a bit of a detour.


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
April 01, 2016, 02:52 PM
Datta
Hi,

Thank you all for the suggestions, but we are trying without radio button. From the html doc we can select FOC_NONE for Ignore Filters, and add All & No Selection from the setting for the Listbox.

When you do that, it passes _FOC_NULL for 'No Selection' and FOC_NONE for 'ALL'. the report works fine, but we are trying to create a Header for three different options...

Can it be done without the radio button?


WebFOCUS 7.6
Windows, All Outputs
April 01, 2016, 03:01 PM
Datta
Eric,

We tried the following also, but it does not work since it can not validate 'FOC_NONE'...

SET &RPT_HEADER = IF '&ST_PROV_MXCSH_NA' EQ '_FOC_NULL' THEN 'US SUMMARY' ELSE IF '&ST_PROV_MXCSH_NA' EQ 'FOC_NONE' THEN 'US TOTAL ALL STATES' ELSE 'US TOTAL BY STATE';

We are trying to find out is there a way to identify the 'FOC_NONE' and code accordingly...

The -IF and -GOTO was just to try in a different way...


WebFOCUS 7.6
Windows, All Outputs
April 01, 2016, 03:08 PM
MartinY
Trying to test FOC_NONE (and either _FOC_NULL) is sometime a pain...

Try
SET &RPT_HEADER = IF '&ST_PROV_MXCSH_NA.EVAL' EQ '_FOC_NULL' THEN 'US SUMMARY' ELSE IF '&ST_PROV_MXCSH_NA.EVAL' EQ 'FOC_NONE' THEN 'US TOTAL ALL STATES' ELSE 'US TOTAL BY STATE';


Using a radio may be an easy way, but you can do the same with list box, drop down, ... until the proper values are built in the control.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
April 01, 2016, 03:26 PM
Datta
Martin,

That was great!!! I totally forgot about the .EVAL, thanks.

It works now for 'No Selection' and 'ALL' perfectly but does not work if I select one or mutiple states:

-SET &RPT_HEADER = IF ''California'' EQ '_FOC_NULL' THEN 'US SUMMARY'
- ELSE IF ''California'' EQ 'FOC_NONE' THEN 'US TOTAL ALL STATES'
- ELSE 'US TOTAL BY STATE';
0 ERROR AT OR NEAR LINE 86 IN PROCEDURE practice_covsel_001_ustotalsms_mainFOCEXEC *
(FOC266) IF .. THEN .. ELSE .. SYNTAX ERROR


WebFOCUS 7.6
Windows, All Outputs
April 01, 2016, 03:30 PM
MartinY
You have to trick it a bit such as:
-IF &ST_PROV_MXCSH_NA CONTAINS 'OR' THEN GOTO WITHOR;

-SET &RPT_HEADER = IF '&ST_PROV_MXCSH_NA.EVAL' EQ '_FOC_NULL' THEN 'US SUMMARY' ELSE IF '&ST_PROV_MXCSH_NA.EVAL' EQ 'FOC_NONE' THEN 'US TOTAL ALL STATES' ELSE 'US TOTAL BY STATE';
-GOTO ENDSET;

-WITHOR
-SET &RPT_HEADER = 'US TOTAL BY STATE';

-ENDSET

I wrote it : "a pain..." Sweating


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
April 01, 2016, 03:39 PM
Datta
It all worked, just don't need the ticks...
-SET &RPT_HEADER = IF &ST_PROV_MXCSH_NA.EVAL EQ '_FOC_NULL' THEN 'US SUMMARY'
- ELSE IF &ST_PROV_MXCSH_NA.EVAL EQ 'FOC_NONE' THEN 'US TOTAL ALL STATES'
- ELSE 'US TOTAL BY STATE';

Thank you all for the suggestions...good discussion..


WebFOCUS 7.6
Windows, All Outputs
April 02, 2016, 12:49 AM
Rifaz
At the end, all you need is just -SET &ECHO='ALL'; Wink


-Rifaz

WebFOCUS 7.7.x and 8.x