Jump to content

I am fairly new to WebFocus using the text editor for coding. I have finally come around to generally understanding it. However, I have what should be a simple question about styling. See Below:


Recommended Posts

Posted

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

Posted

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 END

The output looks like this, the COUNTRY column has "disappeared" or more accurately was squeezed to zero width.

image.png.3fad45f9e2ae58452c27b3e20c24c053.png

Posted

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!

Posted

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
Posted

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}.fex

TABLE FILE SQLOUT

PRINT 

{Field} AS '{Alias}'     &FORMAT3SP

{Field} AS '{Alias}'     &FORMAT1PR                 &FORMAT5SL 

{Field} AS '{Alias}'     &FORMAT1PR                 &FORMAT5SL 

{Field} AS '{Alias}'     &FORMAT3SP

COMPUTE{Field} = {Calculation} AS {Alias}' &FORMAT1PR &FORMAT2LC &FORMAT3SP &FORMAT4PC 

....

BY {Field}                  &FORMAT1PR &FORMAT2LC &FORMAT3SP &FORMAT4PC &FORMAT5SL

BY {Field} AS '{Alias}'       &FORMAT1PR &FORMAT2LC &FORMAT3SP &FORMAT4PC &FORMAT5SL

BY {Field} AS '{Alias}'       &FORMAT2LC &FORMAT3SP &FORMAT4PC &FORMAT5SL

BY {Field}            &FORMAT1PR &FORMAT2LC &FORMAT3SP &FORMAT4PC &FORMAT5SL

BY {Field} AS '{Alias}'       &FORMAT1PR &FORMAT2LC &FORMAT3SP       &FORMAT5SL

BY {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..

Posted

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
Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...