Sean Kiss Posted March 8, 2023 Posted March 8, 2023 Some of the code I have inherited grabs the data and then uses syntax below to do the report build....TYPE=FOOTING, STYLE=BOLD, SIZE=8,$TYPE=TABFOOTING, STYLE=BOLD, SIZE=8,$TYPE=DATA, COLUMN={column name}, JUSTIFY=LEFT, {Conditional function to hide column here would be ideal},$TYPE=DATA, COLUMN={column name}, WHEN={qualification}, BACKCOLOR=RGB(239 239 239), JUSTIFY=CENTER, STYLE=ITALIC+BOLD,$...If I want to hide a column it appears I have to do it before I get to styling for the report. I would like to do it here since so many different variants of the data are used for multiple reports.Presently, I am doing it in the Table build via the NOPRINT based on the type of view I want to create.If I could do it at the end during styling, I could keep the code more centralized.Thank You
David Beagan Posted March 9, 2023 Posted March 9, 2023 Maybe something like this using the SQUEEZE option. TABLE FILE CAR SUM RCOST DCOST BY COUNTRY BY CAR ON TABLE SET PAGE NOLEAD ON TABLE SET GRID OFF ON TABLE SET STYLE * TYPE=REPORT, BORDER=0,$ TYPE=REPORT, COLUMN=COUNTRY, SQUEEZE=0,$ TYPE=TITLE, BACKCOLOR=RGB(240 240 240), $ ENDSTYLE ENDThe output looks like this, the COUNTRY column has "disappeared" or more accurately was squeezed to zero width.
Sean Kiss Posted March 9, 2023 Author Posted March 9, 2023 This looks like a good option, and I will test. My only initial question ( which I will research during testing ) is if the resulting report if exported to xlsx would have an empty existing column or potentially a column that is not transmitted. (Ex: If I SQUEEZE columns 3,5,6 in a 10-column report; would the xlsx report come up with columns A, B, E, F,G,H,I,J populated or A,B,C,D,E,F,G. It may not matter to the end user.Thank You for your help! I let you know how it resolves but it may be a few days before I can get back to it.Thanks again!
Martin Yergeau Posted March 9, 2023 Posted March 9, 2023 David's SWEEZE option does work on v9+ if HTML output format but has no effect on Excel format and not work at all on previous versions.An option that you could have is the following where, based on a received parameter you display or not the column-SET &DISP = IF &RPT EQ 'BYCNTR' THEN '' ELSE 'NOPRINT'; TABLE FILE CARSUM RCOST DCOST BY COUNTRY &DISPBY CARON TABLE PCHOLD FORMAT XLSXON TABLE SET BYDISPLAY ONON TABLE SET PAGE NOLEADON TABLE SET GRID OFFON TABLE SET STYLE *TYPE=REPORT, BORDER=0,$TYPE=TITLE, BACKCOLOR=RGB(240 240 240), $ENDSTYLEEND-RUN
Sean Kiss Posted March 9, 2023 Author Posted March 9, 2023 Martin: What you suggest, is what we have done in the past where the &FORMAT#xx defines the report view we want to build:-SET &FORMAT1PR = IF &{PARAM} EQ '{Value1}' THEN 'NOPRINT' ELSE '' ;-SET &FORMAT2LC = IF &{PARAM} EQ '{Value2}' THEN 'NOPRINT' ELSE '' ;-SET &FORMAT3SP = IF &{PARAM} EQ '{Value3}' THEN 'NOPRINT' ELSE '' ;-SET &FORMAT4PC = IF &{PARAM} EQ '{Value4}' THEN 'NOPRINT' ELSE '' ;-SET &FORMAT5SL = IF &{PARAM} EQ '{Value5}' THEN 'NOPRINT' ELSE '' ;-INCLUDE IBFS:/{SQL Filename}.fexTABLE FILE SQLOUTPRINT {Field} AS '{Alias}' &FORMAT3SP{Field} AS '{Alias}' &FORMAT1PR &FORMAT5SL {Field} AS '{Alias}' &FORMAT1PR &FORMAT5SL {Field} AS '{Alias}' &FORMAT3SPCOMPUTE{Field} = {Calculation} AS {Alias}' &FORMAT1PR &FORMAT2LC &FORMAT3SP &FORMAT4PC ....BY {Field} &FORMAT1PR &FORMAT2LC &FORMAT3SP &FORMAT4PC &FORMAT5SLBY {Field} AS '{Alias}' &FORMAT1PR &FORMAT2LC &FORMAT3SP &FORMAT4PC &FORMAT5SLBY {Field} AS '{Alias}' &FORMAT2LC &FORMAT3SP &FORMAT4PC &FORMAT5SLBY {Field} &FORMAT1PR &FORMAT2LC &FORMAT3SP &FORMAT4PC &FORMAT5SLBY {Field} AS '{Alias}' &FORMAT1PR &FORMAT2LC &FORMAT3SP &FORMAT5SLBY {Field} AS '{Alias}' &FORMAT1PR &FORMAT2LC &FORMAT3SP &FORMAT4PC &FORMAT5SL ... WHERE ('&{PARAM1}' NE '') OR ('&{PARAM1}' EQ '');WHERE ('&{PARAM2}' NE '') OR ('&{PARAM2}' EQ '');WHERE ('&{PARAM2} NE '') OR ('&{PARAM2}' EQ '');WHERE ('&{PARAM3}' NE '');But this is in the Report Build, not the styling, which makes the subsequent segmentation of the styling for 100+ report views more complex than I think it should be particularly when trying to review the code. A couple of weeks ago I restructured the entire process into 3+ segmented fex files. The 1st .fex runs the SQL, the 2nd fex builds the report data set, based on all necessary fields across all views of the report and adhering to the relevant variables set on the GUI options. The 3rd set of fex files or ideally one final fex file would just allow a set of SET/IF statements to run styling based on the five options listed at the top. It may not be the most efficient but would make the process more understandable to the programmer especially if they are coming in new to the technique.$TYPE=DATA, COLUMN={column name}, JUSTIFY=LEFT,{Complex conditional function to hide column here would be ideal},$The above may just not be possible since the NOPRINT is not an option in the styling, even though color, justification, font, etc, are..
Martin Yergeau Posted March 9, 2023 Posted March 9, 2023 You can do the same as for the styling than you do for your run SQL, run fex builts-SET &FORMAT1PR = IF &{PARAM} EQ '{Value1}' THEN 'NOPRINT' ELSE '' ;-SET &FORMAT2LC = IF &{PARAM} EQ '{Value2}' THEN 'NOPRINT' ELSE '' ;-SET &FORMAT3SP = IF &{PARAM} EQ '{Value3}' THEN 'NOPRINT' ELSE '' ;-SET &FORMAT4PC = IF &{PARAM} EQ '{Value4}' THEN 'NOPRINT' ELSE '' ;-SET &FORMAT5SL = IF &{PARAM} EQ '{Value5}' THEN 'NOPRINT' ELSE '' ; -INCLUDE IBFS:/{SQL Filename}.fex TABLE FILE SQLOUTPRINT {Field} AS '{Alias}' &FORMAT3SP{Field} AS '{Alias}' &FORMAT1PR &FORMAT5SL {Field} AS '{Alias}' &FORMAT1PR &FORMAT5SL {Field} AS '{Alias}' &FORMAT3SPCOMPUTE{Field} = {Calculation} AS {Alias}' &FORMAT1PR &FORMAT2LC &FORMAT3SP &FORMAT4PC ....BY {Field} &FORMAT1PR &FORMAT2LC &FORMAT3SP &FORMAT4PC &FORMAT5SLBY {Field} AS '{Alias}' &FORMAT1PR &FORMAT2LC &FORMAT3SP &FORMAT4PC &FORMAT5SLBY {Field} AS '{Alias}' &FORMAT2LC &FORMAT3SP &FORMAT4PC &FORMAT5SLBY {Field} &FORMAT1PR &FORMAT2LC &FORMAT3SP &FORMAT4PC &FORMAT5SLBY {Field} AS '{Alias}' &FORMAT1PR &FORMAT2LC &FORMAT3SP &FORMAT5SLBY {Field} AS '{Alias}' &FORMAT1PR &FORMAT2LC &FORMAT3SP &FORMAT4PC &FORMAT5SL...WHERE ('&{PARAM1}' NE '') OR ('&{PARAM1}' EQ '');WHERE ('&{PARAM2}' NE '') OR ('&{PARAM2}' EQ '');WHERE ('&{PARAM2}' NE '') OR ('&{PARAM2}' EQ '');WHERE ('&{PARAM3}' NE ''); ON TABLE SET STYLE * -IF &STYL EQ 'STYL1' THEN GOTO STYL1;-IF &STYL EQ 'STYL2' THEN GOTO STYL2;-IF &STYL EQ 'STYL3' THEN GOTO STYL3;-INCLUDE IBFS:/{DefaultStyleFexName}.fex-GOTO XENDSTYL-STYL1-INCLUDE IBFS:/{Style1_FexName}.fex-GOTO XENDSTYL-STYL2-INCLUDE IBFS:/{Style2_FexName}.fex-GOTO XENDSTYL-STYL3-INCLUDE IBFS:/{Style3_FexName}.fex-GOTO XENDSTYL-XENDSTYLENDSTYLEEND-RUN
Sean Kiss Posted March 9, 2023 Author Posted March 9, 2023 Martin -Thank you! This method works. I will still need to use the variable NOPRINT Function in the 'Report' section and do the other formatting tweaks in the various style sheets. This method will still greatly lessen the total effort to produce the multiple views. And almost as importantly make it easier to understand the flow.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now