Focal Point
[SOLVED] Conditional Styling a drillmenuitem based on across value

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

November 06, 2008, 05:21 PM
Trav
[SOLVED] Conditional Styling a drillmenuitem based on across value
This is something that is not currently supported in WF, but I'm looking for some ideas on how one might accomplish the same thing. Here is a simple example of what I'm trying to accomplish. Currently, if you run this, it will crash the agent. If you comment out the WHEN condition, it will run successfully. I've logged a case, and was informed that it's not supported and it's documented as such -- but they are going to at least make the message a little nicer as opposed to just crashing.

Ideas?
TABLE FILE CAR
	PRINT 
		CAR
		MODEL
	ACROSS COUNTRY
ON TABLE SET STYLE *
TYPE=DATA,
	WHEN=COUNTRY EQ 'ENGLAND',
	DRILLMENUITEM='DrillDown 1',
		FOCEXEC=TEST,
$
ENDSTYLE
END

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



Production: 7.6.6 WF Server  <=>  7.6.6 WF Client  <=>  7.6.6 Dev Studio
Testing: <none>
Using MRE & BID.  Connected to MS SQL Server 2005
Output Types: HTML, Excel, PDF
November 06, 2008, 05:43 PM
j.gross
Try this:
  
TABLE FILE CAR
  SUM SEATS 
  AND COMPUTE 
      ENG/I1=COUNTRY IS 'ENGLAND'; NOPRINT
  BY CAR
  ACROSS COUNTRY
ON TABLE SET STYLE *
  TYPE=DATA,
  COLUMN=SEATS(*),
  WHEN = ENG EQ 1,
    FOCEXEC=TEST,
$
ENDSTYLE
END



- Jack Gross
WF through 8.1.05
November 06, 2008, 05:43 PM
Mighty Max
How about including COUNTRY NOPRINT?
 
TABLE FILE CAR
PRINT
     COUNTRY NOPRINT
     CAR
     MODEL
ACROSS
     COUNTRY
ON TABLE SET PAGE-NUM NOPAGE
ON TABLE NOTOTAL
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *

$
TYPE=DATA,
     WHEN=COUNTRY EQ 'ENGLAND',
     STYLE=BOLD,
     DRILLMENUITEM='DrillDown 1',          
	      URL=http://www.informationbuilders.com,     
     DRILLMENUITEM='DrillDown 2',          
	      FOCEXEC=DETAILREPORT(PARAMETER=N1),
$
ENDSTYLE
END


-Max


WebFOCUS 8.1.05M Unix Self-Service/MRE/Report Caster - Outputs Excel, PDF, HTML, Flat Files
November 06, 2008, 05:47 PM
Trav
quote:
Originally posted by j.gross:
Try this:

  
TABLE FILE CAR
  SUM SEATS 
  AND COMPUTE 
      ENG/I1=COUNTRY IS 'ENGLAND'; NOPRINT
  BY CAR
  ACROSS COUNTRY
  ON TABLE SET STYLE *
TYPE=DATA,
  COLUMN=SEATS(*),
  WHEN = ENG EQ 1,
    FOCEXEC=TEST,
$
ENDSTYLE
END



That doesn't quite work for me. It doesn't error, but it also doesn't produce the expected results. Change the BY field to BODYTYPE and it becomes a little more clear:

TABLE FILE CAR
  SUM SEATS 
  AND COMPUTE 
      ENG/I1=COUNTRY IS 'ENGLAND'; NOPRINT
  BY BODYTYPE
  ACROSS COUNTRY
  ON TABLE SET STYLE *
TYPE=DATA,
WHEN=ENG EQ 1,
DRILLMENUITEM='DRILLDOWN 1',
FOCEXEC=TEST,
$
ENDSTYLE
END  


The drilldown menu still shows up on "non-England" columns.


EDIT: Looks like you edited your code before I posted. Regardless, your latest method doesn't use drillmenuitem so that doesn't help me.

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



Production: 7.6.6 WF Server  <=>  7.6.6 WF Client  <=>  7.6.6 Dev Studio
Testing: <none>
Using MRE & BID.  Connected to MS SQL Server 2005
Output Types: HTML, Excel, PDF
November 06, 2008, 06:03 PM
Trav
quote:
Originally posted by Mighty Max:
How about including COUNTRY NOPRINT?
 
TABLE FILE CAR
PRINT
     COUNTRY NOPRINT
     CAR
     MODEL
ACROSS
     COUNTRY
ON TABLE SET PAGE-NUM NOPAGE
ON TABLE NOTOTAL
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *

$
TYPE=DATA,
     WHEN=COUNTRY EQ 'ENGLAND',
     STYLE=BOLD,
     DRILLMENUITEM='DrillDown 1',          
	      URL=http://www.informationbuilders.com,     
     DRILLMENUITEM='DrillDown 2',          
	      FOCEXEC=DETAILREPORT(PARAMETER=N1),
$
ENDSTYLE
END


-Max


Unfortunately that doesn't work either. It displays the drillmenuitem on all columns. Sorry, I could have explained better, but the point to my problem is that I want the drill menu item only when country = england. So for across values, that means only on certain columns...



Production: 7.6.6 WF Server  <=>  7.6.6 WF Client  <=>  7.6.6 Dev Studio
Testing: <none>
Using MRE & BID.  Connected to MS SQL Server 2005
Output Types: HTML, Excel, PDF
November 07, 2008, 02:48 AM
Danny-SRL
Trav,
A bit complicated, but apparently a workaround:
  
-* File trav1.fex
-SET &ECHO=ALL;
SET HOLDLIST=PRINTONLY
TABLE FILE CAR
BY COUNTRY
ON TABLE SAVE
END
-RUN
-SET &CTRY=&LINES;
DEFINE FILE CAR
-REPEAT #FCTRY FOR &I FROM 1 TO &CTRY;
-READ SAVE &FCTRY.A10.
-SET &FCTRY.&I=STRIP(10, &FCTRY, ' ', 'A10');
&FCTRY.&I / I6 = IF COUNTRY EQ '&FCTRY' THEN SALES ELSE 0;
-#FCTRY
END
-RUN
TABLE FILE CAR
  SUM 
-REPEAT #FCTRYP FOR &I FROM 1 TO &CTRY;
&FCTRY.&I
-#FCTRYP
  BY BODYTYPE
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=ENGLAND,
DRILLMENUITEM='DRILLDOWN 1',
FOCEXEC=TEST,
$
ENDSTYLE
END



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

November 07, 2008, 09:08 AM
Trav
quote:
Originally posted by Danny-SRL:
Trav,
A bit complicated, but apparently a workaround:
  
-* File trav1.fex
-SET &ECHO=ALL;
SET HOLDLIST=PRINTONLY
TABLE FILE CAR
BY COUNTRY
ON TABLE SAVE
END
-RUN
-SET &CTRY=&LINES;
DEFINE FILE CAR
-REPEAT #FCTRY FOR &I FROM 1 TO &CTRY;
-READ SAVE &FCTRY.A10.
-SET &FCTRY.&I=STRIP(10, &FCTRY, ' ', 'A10');
&FCTRY.&I / I6 = IF COUNTRY EQ '&FCTRY' THEN SALES ELSE 0;
-#FCTRY
END
-RUN
TABLE FILE CAR
  SUM 
-REPEAT #FCTRYP FOR &I FROM 1 TO &CTRY;
&FCTRY.&I
-#FCTRYP
  BY BODYTYPE
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=ENGLAND,
DRILLMENUITEM='DRILLDOWN 1',
FOCEXEC=TEST,
$
ENDSTYLE
END


Makes sense -- you're turning the across values into their own defines... I'm thinking about how that will work in my example -- I have multiple across values already, so it's definitely complicate things a bit. It gives me an option to explore though.

Thanks for your help!



Production: 7.6.6 WF Server  <=>  7.6.6 WF Client  <=>  7.6.6 Dev Studio
Testing: <none>
Using MRE & BID.  Connected to MS SQL Server 2005
Output Types: HTML, Excel, PDF
November 07, 2008, 11:36 AM
j.gross
There is anomolous behavior, and I've pinned down the source.

Run this code, with and without "HIGHEST" on the ACROSS:
DEFINE FILE CAR
ENGLISH/I3 = COUNTRY EQ 'ENGLAND';
OTHERS /I3 = COUNTRY NE 'ENGLAND';
END
TABLE FILE CAR
  SUM ENGLISH OTHERS 
  BY SEATS
  ACROSS HIGHEST COUNTRY
ON TABLE SET STYLE *
  TYPE=DATA,  COLUMN=ENGLISH(*),  WHEN = ENGLISH NE 0, DRILLMENUITEM=Drill1,   FOCEXEC=TEST1 (ENGLISH OTHERS),$
  TYPE=DATA,  COLUMN=OTHERS(*),   WHEN = OTHERS  NE 0, DRILLMENUITEM=Drill2,   FOCEXEC=TEST2 (ENGLISH OTHERS),$
ENDSTYLE
END


When you use the (*) notation, the styling potentially applies to all the across-value instances -- BUT WebFocus computes the WHEN condition from the first across-column's cell's values, rather than from each respective column's. Hence whatever rule deserves to be applied to the cell in the first column (England when you omit HIGHEST, W. Germany when you include it) gets applied to all the "across" cels in that row, whether populated or null.

The ( ) syntax for specifying the across instance(s) is allowed and respected in COLUMN=, but is not allowed in WHEN=expression; and without that qualification, the columns named in the When condition are taken to refer to the first column of that name. That's counter-intuitive, and deserves to be rectified.

I'd propose that the behavior be revised: For styled items in the scope of COLUMN=somefield(*), references in a WHEN clause's condition to somefield (and to other verb objects at the same level) should be implicitly qualified to refer to the instance of the item that is being styled. That's much more intuitive than the present behavior. Similarly for explicit styling of a single instance, like COLUMN=ENGLISH(3)


- Jack Gross
WF through 8.1.05
November 07, 2008, 11:58 AM
Hua
Maybe this will work:

TABLE FILE CAR
PRINT
COUNTRY NOPRINT
CAR
MODEL
ACROSS
COUNTRY
ON TABLE SET PAGE-NUM NOPAGE
ON TABLE NOTOTAL
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *

$
TYPE=DATA,
COLUMN = CAR,
WHEN=COUNTRY EQ 'ENGLAND',
STYLE=BOLD,
DRILLMENUITEM='DrillDown 1',
URL=http://www.informationbuilders.com,
DRILLMENUITEM='DrillDown 2',
FOCEXEC=DETAILREPORT(PARAMETER=N1),
$
ENDSTYLE
END


Developer Studio 7.6.11
AS400 - V5R4
HTML,PDF,XLS
November 07, 2008, 12:20 PM
Trav
Hua, that seems like it works. It looks like the key to success is having the COUNTRY NOPRINT and the COLUMN=CAR. I was able to get your example to work properly. However, our report is still crashing -- but our developer is looking into that, so maybe something else is going on too...

Thanks!



Production: 7.6.6 WF Server  <=>  7.6.6 WF Client  <=>  7.6.6 Dev Studio
Testing: <none>
Using MRE & BID.  Connected to MS SQL Server 2005
Output Types: HTML, Excel, PDF
November 07, 2008, 01:44 PM
j.gross
quote:
Hua, that seems like it works.

Only seems so. Hua's example only works because ENGLAND is the first Across value. Try it for FRANCE instead...
TABLE FILE CAR
PRINT COUNTRY NOPRINT  CAR  MODEL
ACROSS COUNTRY
ON TABLE SET PAGE-NUM NOPAGE
ON TABLE NOTOTAL
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
TYPE=DATA,
COLUMN = CAR,
WHEN=COUNTRY EQ 'FRANCE',
STYLE=BOLD,
DRILLMENUITEM='DrillDown 1', URL=http://www.informationbuilders.com, 
DRILLMENUITEM='DrillDown 2', FOCEXEC=DETAILREPORT(PARAMETER=N1),
$
ENDSTYLE
END
...PEUGEOT won't be hyperlinked -- because in
TYPE=DATA,
COLUMN = CAR,
WHEN=COUNTRY EQ 'ENGLAND',

CAR refers only to the first instance. Even broadening the qualification by using CAR(*), or pointing to the column under France with CAR(2), nothing would be hyperlinked, because "WHEN=COUNTRY EQ 'FRANCE'" refers to the first COUNTRY verb-object column, where COUNTRY is ENGLAND, so "COUNTRY EQ 'FRANCE'" is rated "false" for every data column.

Same behavior that I noted above.

This message has been edited. Last edited by: j.gross,


- Jack Gross
WF through 8.1.05
November 07, 2008, 01:59 PM
Trav
Changing COLUMN=CAR to ACROSSCOLUMN=CAR seems to fix that -- I didn't catch it earlier but one of my developers did...

TABLE FILE CAR
	PRINT 
		COUNTRY NOPRINT
		CAR
		MODEL
	ACROSS COUNTRY
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
TYPE=DATA,
ACROSSCOLUMN=CAR,
	WHEN=COUNTRY EQ 'ITALY',
	DRILLMENUITEM='ITALY',
		FOCEXEC=TEST,
$
TYPE=DATA,
ACROSSCOLUMN=CAR,
	WHEN=COUNTRY EQ 'ENGLAND',
	DRILLMENUITEM='ENGLAND',
		FOCEXEC=TEST,
$
ENDSTYLE
END




Production: 7.6.6 WF Server  <=>  7.6.6 WF Client  <=>  7.6.6 Dev Studio
Testing: <none>
Using MRE & BID.  Connected to MS SQL Server 2005
Output Types: HTML, Excel, PDF
November 07, 2008, 02:15 PM
j.gross
Slight correction to Danny's code -- apply strip to the fieldname (&FCTRY) but not to the value (&COUNTRY in corrected code below):

SET HOLDLIST=PRINTONLY
TABLE FILE CAR
BY COUNTRY
ON TABLE SAVE
END
-RUN
-SET &CTRY=&LINES;

DEFINE FILE CAR
-REPEAT #FCTRY FOR &I FROM 1 TO &CTRY;
-READ SAVE &COUNTRY.A10.
-SET &FCTRY.&I=STRIP(10, &COUNTRY, ' ', 'A10');
&FCTRY.&I / I6 = IF COUNTRY EQ '&COUNTRY' THEN SALES ELSE 0;
-#FCTRY
END
-RUN
TABLE FILE CAR
  SUM
-REPEAT #FCTRYP FOR &I FROM 1 TO &CTRY;
&FCTRY.&I
-#FCTRYP
  BY BODYTYPE
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=ITALY ,
DRILLMENUITEM='DRILLDOWN 1',
FOCEXEC=SESSION/CTEST(COUNTRY ENGLAND FRANCE ITALY JAPAN WGERMANY),
$
ENDSTYLE
END


But, alas, there are still problems -- when COUNTRY is passed as an argument of the drilldown, the value passed is blank. (The A tag for the 12400 value in the (COUPE,ITALY) cell is
HREF="javascript:MDitemClick(0,'COUNTRY=&ENGLAND=0&FRANCE=0&ITALY=12400&JAPAN=0&WGERMANY=0','');"
)


- Jack Gross
WF through 8.1.05
November 08, 2008, 12:24 PM
Danny-SRL
Jack,

As you correctly understood, the STRIP function is used to take out the blanks when creating the field name. You just replaced the &variable &FCTRY with &COUNTRY.

What Trav wanted to do is pass a value to the called focexec when the the ACROSS field is equal to ENGLAND. Now he just has to pass the value for the field ENGLAND. I completed the focexec and added another one for drill-down. It seems to work quite well.
TRAV1:
  
SET HOLDLIST=PRINTONLY
TABLE FILE CAR
BY COUNTRY
ON TABLE SAVE
END
-RUN
-SET &CTRY=&LINES;
DEFINE FILE CAR
-REPEAT #FCTRY FOR &I FROM 1 TO &CTRY;
-READ SAVE &FCTRY.A10.
-SET &FCTRY.&I=STRIP(10, &FCTRY, ' ', 'A10');
&FCTRY.&I / I6 = IF COUNTRY EQ '&FCTRY' THEN SALES ELSE 0;
-#FCTRY
END
-RUN
TABLE FILE CAR
  SUM
-REPEAT #FCTRYP FOR &I FROM 1 TO &CTRY;
&FCTRY.&I
-#FCTRYP
  BY BODYTYPE
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=ENGLAND,
DRILLMENUITEM='DRILLDOWN 1',
FOCEXEC=TRAVTEST(VAL=ENGLAND),
DRILLMENUITEM='DRILLDOWN 2',
URL=http://www.google.com,
$
ENDSTYLE
END

TRAVTEST:
  
-TYPE &VAL

Maybe Trav's application is more complicated.


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

November 08, 2008, 07:09 PM
j.gross
Danny --

When there's no road from here to there, a dialog-manager pontoon bridge is the short-term solution. But IBI should address the gap in the road system.

IBI added the ACROSSCOLUMN=acrossfield(*) indexing syntax, similar to indexing syntax long available in FRL, to identify elements for styling of ACROSS reports. They ought to provide similar support (new syntax, or [gasp!] revised behavior for the existing syntax) for style attributes -- in the column references of drilldown arguments, and in the column references of WHEN conditions -- making the expressions self-relocating, like formulas in spreadsheets, so developers could readily utilize ACROSS syntax, and style the presentation in a natural way.

I found it surprising that the column references are taken as absolute references, as if indexed with (1) -- and further astonishing that there is in fact no way to qualify the references (in WHEN and drilldown parameter lists). As others have written, language designers should strive to minimize the astonishment factor.

שבוע טוב

This message has been edited. Last edited by: j.gross,


- Jack Gross
WF through 8.1.05
November 09, 2008, 01:09 AM
Danny-SRL
Jack,

No discussion about that. I agree wholeheartedly. And yes, we have all been used to find workarounds.

?האם אתה מגיע לארץ


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