Focal Point
[SOLVED] need help in coding of WF 8

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

March 09, 2016, 01:45 PM
N/A
[SOLVED] need help in coding of WF 8
hello,
I am new in Development. My codes run in following way:
DEFAULT &ST_PROV_AB = 'ALL';
Table
IF &ST_PROV_AB EQ 'ALL' THEN GOTOLBL_USTOTALRPT;
-LBL_USTOTALRPT;
SUM
BY
HEADING
WHERE
STYLE
ENDSTYLE
-IF &ST_PROV_AB NE 'ALL' THEN GOTO BL_USBYSTATE;
-LBL_USBYSTATE
SUM
BY
HEADING
WHERE
STYLE
ENDSTYLE
END
WHEN I SELECT all it should give a particular kind of report and when ALL is not selected it should give me individual state report. It is done in Text Editor only. Please advice
PA

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


WebFOCUS 8
Windows 7
HTML
March 09, 2016, 03:24 PM
MartinY
Try to reproduce your need with the CAR file and you'll find the answer yourself, trust me, you will... Music

And you'll be proud to have it found yourself Smiler


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
March 09, 2016, 04:10 PM
BabakNYC
Based on what you describe here's an example to follow:

TABLE FILE CAR
-IF &TEST EQ 'ALL' THEN GOTO JUMP;
SUM RCOST DCOST
BY COUNTRY
WHERE COUNTRY EQ 'ENGLAND' OR 'FRANCE';
HEADING
"THIS IS REPORT 1"
-GOTO SKIP;
-JUMP;
SUM SALES 
BY CAR
HEADING
"THIS IS REPORT 2"
WHERE RCOST LT 2000;
-SKIP;
END




You have to skip over the second part of your report which is what I think is missing in your pseudocode.


WebFOCUS 8206, Unix, Windows
March 10, 2016, 10:57 AM
N/A
Thanks a lot! Let me explain little detailed.I followed the code and get some good results. but still error.
I have to create two report:
Default @STATE = 'All' , it should give a summary report of State Total
Default@ STATE = ' CA' , or any state. It should give individual state report
My code:
TABLE FILE ABC
IF @ STATE EQ 'ALL' THEN GO TO JUMP;
SUM
BY COV TYPE
WHERE COV
WHERE DATE
HEADING
STYLING( DRILL DOWN)
ENDSTYLE
-GOTO SKIP;
-JUMP;
SUM
BY STATE NOPRINT
BY COV TYPE
WHERE COV
WHERE DATE
WHERE STATE
HEADING
STYLING(DRILL DOWN DIFFERENT COLUMN AS WE ARE SKIPPING ONE BY)
ENDSTYLE
-SKIP;
END


WebFOCUS 8
Windows 7
HTML
March 10, 2016, 11:20 AM
BabakNYC
The first IF has to start with - and GOTO is one word so it should read:
-IF &STATE EQ 'ALL' THEN GOTO JUMP;


There's a difference between IF as a selection criteria and -IF which allows you to GOTO some label.


WebFOCUS 8206, Unix, Windows
March 10, 2016, 11:20 AM
MartinY
Let's simpler:
-IF &STATE EQ 'ALL' THEN GOTO SUMRPT ELSE GOTO DETRPT;

-SUMRPT
TABLE FILE CAR
SUM RETAIL_COST
BY COUNTRY
END
-RUN
-GOTO XEND;

-DETRPT
TABLE FILE CAR
SUM RETAIL_COST
BY COUNTRY
BY CAR
BY MODEL
END
-RUN
-XEND


Build two reports and call the one you need.
And it's not the only way, there are several one such as having DM between the code, calling different fex, ...


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
March 10, 2016, 11:23 AM
BabakNYC
I'm with MartinY on this one. You're building a lot of complexity into this code by doing it this way. Maintaining two reports and running the one you want is the right way to do it.


WebFOCUS 8206, Unix, Windows
March 11, 2016, 12:39 PM
N/A
I agree1 Thanks a lot ! I did in this way and it is working in Fex. Thanks a lot! Good One


WebFOCUS 8
Windows 7
HTML
March 11, 2016, 01:24 PM
Ricardo Augusto
Hail skilled coders!


WebFOCUS 8.1.05 / APP Studio
March 14, 2016, 01:20 PM
Lynsi
Thank you for the feedback we identified the setting that was causing the issue.

Its in the excel trust center
Protected Views
the enable protected view for files located in potentially unsafe locations needs to be unchecked.


WebFOCUS 7.7 and WebFOCUS 8
Windows, All Outputs
March 14, 2016, 01:33 PM
MartinY
Lynsi, you've replied on the wrong post Smiler

S/B : Report Opens in Excel - Ability to edit spreadsheet is disabled


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
March 14, 2016, 02:15 PM
N/A
hello,
Basing on this code I did and my fex is working well give two reports when called. If I give individual states it gives me a report( &STATE = 'CA' and if I give &STATE = 'ALL'IT GIVES ME A summary REPORT OF TOOTALS. however I AM FINDING ONE issues in HTML. I have two control , one is States and another is Date. When I select individual states like CA,NJ,NY... and dates it gives me individual states report. In the States control I also selected display 'ALL' values in setting. When I select 'ALL' it gives me report of all states values. That means the Second report is not picking up. This is my statements
-IF &ST_PROV_AB EQ 'ALL' THEN GOTO LBL_USTOTALRPT ELSE GOTO LBL_STATE;

Please suggest.
Regards,
PN


WebFOCUS 8
Windows 7
HTML
March 14, 2016, 02:29 PM
Squatch
Did you create an HTML page with controls on it? If you did you can see what is being passed by adding these two lines at the top of your fex file:

-? &
-EXIT

If you are not using an HTML page with controls, then make sure 'ALL' is uppercase. In an earlier post, you had lowercase:

Default @STATE = 'All' , it should give a summary report of State Total
Default@ STATE = ' CA' , or any state. It should give individual state report



App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
March 14, 2016, 03:38 PM
MartinY
If you've built your control within an HTML page using HTML composer or AppStudio, the 'Add ALL Option' doesn't pass 'ALL' to your fex but by default it's: _FOC_NULL.

So, your -IF &ST_PROV_AB EQ 'ALL' ... will not be true since &STATES will be equal to _FOC_NULL.

Normally, using the 'ALL' option is to "ignore something/a line", this is the action 'executed' by FOCUS when it found, on execution, something such as :
TABLE FILE BLABLA
PRINT *
WHERE BLABLABLA EQ _FOC_NULL;
END

The WHERE is ignore so it's like having a print everything.

But all this is basic FOCUS training, maybe you need some if you don't already ?


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
March 15, 2016, 10:23 AM
N/A
quote:
Originally posted by Squatch:
Did you create an HTML page with controls on it? If you did you can see what is being passed by adding these two lines at the top of your fex file:

-? &
-EXIT

If you are not using an HTML page with controls, then make sure 'ALL' is uppercase. In an earlier post, you had lowercase:

Default @STATE = 'All' , it should give a summary report of State Total
Default@ STATE = ' CA' , or any state. It should give individual state report


Dear Squatch,
Thanks a lot! I have created three control in HTML. one is for Report selection(WFFMT). SECOND ONE IS DATE AND THIRD ONE IS STATE(The data is populated from &ST_PROV_AB column.
-IF &ST_PROV_AB EQ 'ALL' THEN GOTO LBL_USTOTALRPT ELSE GOTO LBL_STATE; In the state control when I select single state it is working fine. I am thinking what to do for ALL option of states and it should give a summary report. In the control of state if I add ALL option from setting it is giving FOC_NUll value which is true according to Martin.sO, DO I have to create a separate control for ALL STATE? AND IF I HAVE TO WRITE FEW FEX code where to write it? Thanks.


WebFOCUS 8
Windows 7
HTML
March 15, 2016, 10:31 AM
Francis Mariani
As already explained, the "FOC_NULL" value will make WF ignore the WHERE statement, which means you will get all states. You don't have to do anything special in the fex. Have you read the manual regarding "FOC_NULL"? Have you tried running the HTML page, selecting ALL and seeing what is passed to the fex?


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
March 15, 2016, 11:21 AM
N/A
THANK YOU! I really appreciate your advice and learning codes too but I said very new to development. I have also few trainings from IBI already. Currently cannot do but later yes. All my expectation is working fine in Fex. single state and ALL SUMMSRY States. The problem comes with HTML. In the control of States I want to show LBL_USTOTALRPT (SUMMARY) WHEN I GO 'ALL' option of control of states(HTML). here is my fex. May be I am missing something.
-DEFAULT &ISO_CAL_Y_MO_AB ='_FOC_NULL';
-DEFAULT &CV_DSPLY_NA ='_FOC_NULL';
-*-DEFAULT &ST_PROV_AB = 'ALL';(commented when do HTML)

-DEFAULT &WFFMT = 'HTML';

-IF &ST_PROV_AB EQ 'ALL' THEN GOTO LBL_USTOTALRPT ELSE GOTO LBL_STATE;

-LBL_USTOTALRPT
TABLE FILE PVT
PRINT
ISO.. NOPRINT AS 'SNAPSHOT'
NEW_M AS 'NO OF CVG'
NEW .. AS 'PREMIUM'

ST_PROV_AB NOPRINT AS 'STATE'
BY CV_DSPLY_NA AS 'COVERAGE TYPE'
WHERE &ST_PROV_AB = '_FOC_NULL';
END
TABLE FILE PVTF...
SUM
ISO NOPRINT AS 'SNAPSHOT'
NEW_AS 'NO OF CVG'
NEW_ AS 'PREMIUM'

ST_PROV_AB NOPRINT AS 'STATE'
BY CV_ AS 'COVERAGE TYPE'
HEADING
WHERE WHERE ( CV_DSPLY_NA EQ &CV_DSPLY_NA.(OR()).CV_DSPLY_NA. );
WHERE ( ISO_CAL_Y_MO_AB EQ &ISO_CAL_Y_MO_AB.(OR()).ISO_CAL_Y_MO_AB.QUOTEDSTRING);
ON TABLE SET STYLE...
ENDSTYLE
END


WebFOCUS 8
Windows 7
HTML
March 15, 2016, 01:44 PM
Squatch
quote:
-IF &ST_PROV_AB EQ 'ALL' THEN GOTO LBL_USTOTALRPT ELSE GOTO LBL_STATE;

You probably need something like this:

-IF &ST_PROV_AB EQ '_FOC_NULL' THEN GOTO LBL_USTOTALRPT ELSE GOTO LBL_STATE;



App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
March 15, 2016, 03:08 PM
N/A
I DID IT BUT IT SHOWS NOT THE SUMMARY ONE.I WANT TO CALL LBL_USTOTALRPT. IT IS SHOWING DETAIL REPORT WITH NO STYLING.


WebFOCUS 8
Windows 7
HTML
March 15, 2016, 03:17 PM
Francis Mariani
The first problem is that you're not posting all your code - I don't have a clue what label LBL_STATE is because I don't see it in your code.

When you post code, please use the code button:



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
March 15, 2016, 03:25 PM
Francis Mariani
-*-DEFAULT &COUNTRY = 'FOC_NULL';
-DEFAULT &COUNTRY = 'ENGLAND';

-IF &COUNTRY EQ 'FOC_NULL' GOTO LBL_USTOTALRPT ELSE GOTO LBL_USBYSTATE;

-LBL_USTOTALRPT 

TABLE FILE CAR
SUM SALES
BY COUNTRY
HEADING
"SUMMARY REPORT"
END
-RUN

-GOTO LBL_END

-LBL_USBYSTATE

TABLE FILE CAR
SUM SALES
BY CAR
WHERE COUNTRY EQ '&COUNTRY'
HEADING
"REPORT FOR COUNTRY: <COUNTRY"
END
-RUN

-LBL_END

Switch between the two -DEFAULT statements to see the difference. Then try this with a parameter screen passing the value.

Good luck.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
March 16, 2016, 10:55 AM
N/A
Thank you so much! I tried and it worked. YAHOOOO....
Razzer


WebFOCUS 8
Windows 7
HTML
March 16, 2016, 11:01 AM
Francis Mariani
It took much too long to get to this point.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
March 16, 2016, 11:06 AM
N/A
quote:
Originally posted by Francis Mariani:
It took much too long to get to this point.

I know so what do you suggest?


WebFOCUS 8
Windows 7
HTML
March 16, 2016, 11:13 AM
Francis Mariani
Take some training.

Read the manual.

Be very precise in your posts.

Use an IBI supplied table to create "reproduce-able" code that any FocalPointer can run and modify. The CAR file is the easiest for this purpose, though it does not have date fields..


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
March 16, 2016, 11:14 AM
Squatch
Best thread ever... Smiler


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
March 16, 2016, 01:35 PM
N/A
Thanks. which manuals you are suggesting? And I have no idea about IBI supplied table to create reproduce-able. Is there any video how to approach that?
Regards,
Niha


WebFOCUS 8
Windows 7
HTML
March 18, 2016, 07:45 AM
MartinY
If you don't know about IBI sample tables you're starting from far away (no offense) Eeker

Contact your IBI rep, it's the better starting point


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