Focal Point
Dynamic conditional formatting

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

May 10, 2012, 06:07 PM
roy
Dynamic conditional formatting
In a guided ad-hoc report where you don't know the sequence of selected elements (user will determine that at runtime)
How can we add conditional formatting to a cell when we have no clue what the Nn will be
example

DEFMACRO=COND0001,
MACTYPE=RULE,
WHEN=N3 EQ 'RED', can the when = be a guided ad-hoc parameter?

I tried a WHEN = N* that didn’t work, tried C* and that also wasn’t successful
Respectfully,


WebFOCUS 7.6
Windows, All Outputs
May 11, 2012, 06:06 AM
Danny-SRL
You say "Guided Ad-Hoc". I suppose that means that the user provides the field names.
In that case, you could use:
  
DEFMACRO=COND0001,
MACTYPE=RULE,
WHEN=fieldname EQ 'RED'



Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

May 11, 2012, 08:26 AM
roy
What if the field name is not selected by the user at run time will the fex run or will an error be generated?

That was a good idea but as user are fickle if they don’t select the field at runtime we end up with the error
(FOC3202) BAD VALUE IN STYLESHEET FILE AT LINE 18: MACRO=COND0001
So that will not fit the Dynamic user ad-hoc kind of conditional formatting but is was worth a try and I thank you for your attention to this request for help.


WebFOCUS 7.6
Windows, All Outputs
May 11, 2012, 08:51 AM
j.gross
You can place all the unused choices at the end of the list of verb objects, with NOPRINT, and code
TYPE=(as applicable), COLUMN=fieldname, ..., WHEN=fieldname EQ 'value', $

Both references to fieldname will then be syntactically valid. If fieldname is selected by the user and appears (earlier in the list) as a visible verb-object, the rule will be applied there (and both the selection and the condition will be taken as references to the printed column); otherwise the rule will refer to the NOPRINT verb object and will be valid but will have to no effect on rendition of the report.

This assumes that all the selectable verb objects are listed in a single segment of the synonym. If that is not so, there could be side-effects from the inclusion of the additional fields.

This message has been edited. Last edited by: j.gross,
May 11, 2012, 09:30 AM
roy
That worked thank you...

Let me share
Dynamic summaries from a guided parameter report with 7.6.4 where multiple BY is not recognized


might be a useful tip for someone.

-* Set up and strip the user parameter into usable code for the table file note I add NOPRINT to each &USERSELECT


&USERSELECT = '&USERSELECT'

  &USERSELECT.(AND(<THE_TEAM_#,THE_TEAM_# NOPRINT>,<TEAM_NAME,TEAM_NAME NOPRINT>,<COUNTRY,COUNTRY NOPRINT>,<STATEPROVINCE,STATEPROVINCE NOPRINT>,<CITY,CITY NOPRINT>,<ZIPCODE,ZIPCODE NOPRINT>,<ADDRESS,ADDRESS NOPRINT>,<DATE_APPROVED_BIA,DATE_APPROVED_BIA NOPRINT>,<THE_PROCESS,THE_PROCESS NOPRINT>,<DEFAULT_BP_CRITICALITY,DEFAULT_BP_CRITICALITY NOPRINT>,<TEAM_REQUIRED_CRITICALITY,TEAM_REQUIRED_CRITICALITY NOPRINT>,<REJECTREASON,REJECTREASON NOPRINT>,<COMMENTS,COMMENTS NOPRINT>,<DAILYREVENUELOSS,DAILYREVENUELOSS NOPRINT>,<DAILYPENALTIES,DAILYPENALTIES NOPRINT>,<AVERAGETRANSACTVALUES,AVERAGETRANSACTVALUES NOPRINT>,<PEAKTRANSACTVALUES,PEAKTRANSACTVALUES NOPRINT>,<APPLICATIONCODE,APPLICATIONCODE NOPRINT>,<SERVICE_APPLICATION_NAME,SERVICE_APPLICATION_NAME NOPRINT>,<LEVEL3,LEVEL3 NOPRINT>,<R_ADDRESS,R_ADDRESS NOPRINT>,<R_CITY,R_CITY NOPRINT>,<R_STATE,R_STATE NOPRINT>,<R_COUNTRY,R_COUNTRY NOPRINT>,<R_ZIP,R_ZIP NOPRINT>,<R_NAME,R_NAME NOPRINT>)).1st PART BODY OF REPORT.


-SET &TEXT2 = STRREP(&USERSELECT.LENGTH,&USERSELECT,3,'AND',2,'BY',&USERSELECT.LENGTH,'&USERSELECT');
-SET &THEBY = STRIP(&TEXT2.LENGTH,&TEXT2,'''',&TEXT2);

-SET &THEPSUM = STRREP(&USERSELECT.LENGTH,&USERSELECT,7,'NOPRINT',1,'''',&USERSELECT.LENGTH,'&USERSELECT');
-SET &THESUMP = STRIP(&THEPSUM.LENGTH,&THEPSUM,'''',&THEPSUM);

-TYPE &THESUMP
-TYPE &THEBY


-* end of parameter prep work


in my world the SQL stuff that is the "MST" file
then

TABLE FILE SQLOUT
SUM FST
&THESUMP
BY &THEBY NOPRINT

This query has distinct records at the detail if (all) columns are selected

But if you selected a subset of the columns it looked like there were duplicates rows

By dynamically linking the user selection with the "by" any possible summary is possible this is probably a mute point with a higher version of web focus...


WebFOCUS 7.6
Windows, All Outputs