Focal Point
[Solved] Variable column output

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

December 16, 2010, 11:27 AM
JOE
[Solved] Variable column output
Is it possible to have variable column selection on the HTML lauch page. Example..An HTML report output has the potential to have up to 10 output fields. I was thinking of letting the user select which fields they want to view. I would think these amp variables would be basically NOPRINT or ' ' for values. Anybody have any examples handy. Thanks!

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


WebFocus 7.7.02 WinXP
December 16, 2010, 11:37 AM
T.Peters
Could you make an active report and hide those columns? At runtime your user should be able to unhide the columns he/she wants.


WebFOCUS: 7702
O/S : Windows
Data Migrator: 7702
December 16, 2010, 01:15 PM
Glenda
This is how we do it. Though there may be an easier way.

HTML
Used the HTML to set one long string:

1. Create a variable for each available output field choice using check boxes to populate them where the value is “1” if box is checked and “0” when the box is unchecked.

2. Concatenate the variables together with a “-“ in between each variable:

INP10 = tf01 + '-' + tf02 + '-' + tf03 + '-' + tf04 + '-' + tf05 + '-' + tf06 + '-' + tf07 + '-' + tf08 + '-' + tf09 + '-' + tf10 + '-'


FEX
Pass this variable to your fex and use the GETTOK function to set the print fields.
-SET &VSTRING = &INP10;
-SET &FLD01 = IF GETTOK(&VSTRING, 100, 1, '-', 60, 'A60')=1 THEN 'ECSHDRKEY  AS ''BATCH#''' ELSE '-*';
-SET &FLD02 = IF GETTOK(&VSTRING, 100, 2, '-', 60, 'A60')=1 THEN 'POE        AS ''P / E''' ELSE '-*';
-SET &FLD03 = IF GETTOK(&VSTRING, 100, 3, '-', 60, 'A60')=1 THEN 'CLMHDRKEY  AS ''CLAIM NO''' ELSE '-*';
-SET &FLD04 = IF GETTOK(&VSTRING, 100, 4, '-', 60, 'A60')=1 THEN 'CHSTAT     AS ''STATUS''' ELSE '-*';
-SET &FLD05 = IF GETTOK(&VSTRING, 100, 5, '-', 60, 'A60')=1 THEN 'CHLOCA     AS ''CO''' ELSE '-*';
-SET &FLD06 = IF GETTOK(&VSTRING, 100, 6, '-', 60, 'A60')=1 THEN 'EDMEMB     AS ''POLICY#''' ELSE '-*';
-SET &FLD07 = IF GETTOK(&VSTRING, 100, 7, '-', 60, 'A60')=1 THEN 'CHGPNO     AS ''GROUP''' ELSE '-*';
-SET &FLD08 = IF GETTOK(&VSTRING, 100, 8, '-', 60, 'A60')=1 THEN 'ERSTAT     AS ''PATIENT STATE''' ELSE '-*';
-SET &FLD09 = IF GETTOK(&VSTRING, 100, 9, '-', 60, 'A60')=1 THEN 'EDFNAM     AS ''FIRST NAME''' ELSE '-*';
-SET &FLD10 = IF GETTOK(&VSTRING, 100, 10, '-', 60, 'A60')=1 THEN 'EDLNAM     AS ''LAST NAME''' ELSE '-*';

TABLE FILE FILENAME (OR HOLD)
PRINT
&FLD01.EVAL
&FLD02.EVAL
&FLD03.EVAL
&FLD04.EVAL
&FLD05.EVAL
&FLD06.EVAL
&FLD07.EVAL
&FLD08.EVAL
&FLD09.EVAL
&FLD10.EVAL



Glenda

In FOCUS Since 1990
Production 8.2 Windows
December 16, 2010, 04:12 PM
Waz
I would suggest not commenting out the columns, but NOPRINTing them, then any stylesheet options for individual columns will not be lost.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

December 16, 2010, 04:29 PM
Glenda
Very good suggestion.

The user that required the data from our fex wanted nothing but data with a header row on his EXCEL spreadsheet so commenting out opposed to "noprint" didn't matter. However if you are using stylesheet options, you will need to use noprint if your stylesheet options are based on column numbers as opposed to column names.

If your stylesheet options use column names then either way will work.


Glenda

In FOCUS Since 1990
Production 8.2 Windows
December 16, 2010, 11:55 PM
JOE
Thanks!..this gives me something to work with...I'll report back with my results.


WebFocus 7.7.02 WinXP
December 22, 2010, 12:33 PM
JOE
Thanks for the help..I was able to do this
 -SET &AHT1 = IF &AHT EQ 1 THEN ' ' ELSE 'NOPRINT';
-SET &CIQP1 = IF &CIQP EQ 2 THEN ' ' ELSE 'NOPRINT';
-SET &QMT1 = IF &QMT EQ 3 THEN ' ' ELSE 'NOPRINT';
-SET &ALLQ1 = IF &ALLQ EQ 4 THEN ' ' ELSE 'NOPRINT';
-SET &REV1 = IF &REV EQ 5 THEN ' ' ELSE 'NOPRINT';
-SET &UNIT1 = IF &UNIT EQ 6 THEN ' ' ELSE 'NOPRINT';
-SET &BBCR1 = IF &BBCR EQ 7 THEN ' ' ELSE 'NOPRINT';
-SET &BBCRU1 = IF &BBCRU EQ 8 THEN ' ' ELSE 'NOPRINT';
-SET &OBCU1 = IF &OBCU EQ 9 THEN ' ' ELSE 'NOPRINT';
-SET &CALLT1 = IF &CALLT EQ 10 THEN ' ' ELSE 'NOPRINT';
-SET &RETCALL1 = IF &RETCALL EQ 11 THEN ' ' ELSE 'NOPRINT';
-SET &CALLOW1 = IF &CALLOW EQ 12 THEN ' ' ELSE 'NOPRINT';
-SET &ADH1 = IF &ADH EQ 13 THEN ' ' ELSE 'NOPRINT';
-SET &CHAT1 = IF &CHAT EQ 14 THEN ' ' ELSE 'NOPRINT';
-SET &EMAP1 = IF &EMAP EQ 15 THEN ' ' ELSE 'NOPRINT';
-SET &SUCP1 = IF &SUCP EQ 16 THEN ' ' ELSE 'NOPRINT'; 
and place the variable either as print or noprint based on the output selections..thanks again!


WebFocus 7.7.02 WinXP