Focal Point
[Sharing] Recursive Drill-Down

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

November 04, 2013, 06:33 AM
Danny-SRL
[Sharing] Recursive Drill-Down
One of my customers had the following request which I will state using the CAR file.

A report shows SALES BY COUNTRY:


When clicking on COUNTRY a new report is to be shown in the same window showing SALES BY COUNTRY BY CAR but only display the CARs for the clicked COUNTRY:


This is the solution I came up with:
  
-* File recursive.fex

-DEFAULTH &COUNTRY=' ';
-SET &XCAR=IF &COUNTRY EQ ' ' THEN '' ELSE 'CAR';

DEFINE FILE CAR
 XCAR/A16=IF COUNTRY EQ '&COUNTRY' THEN CAR ELSE ' ';
END

TABLE FILE CAR
SUM CAR.BODY.SALES
BY CAR.ORIGIN.COUNTRY
BY XCAR AS '&XCAR'
ON TABLE PCHOLD FORMAT HTML
ON TABLE NOTOTAL
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET SQUEEZE ON
ON TABLE SET EMPTYREPORT ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
 INCLUDE=endeflt,$
TYPE=DATA, COLUMN=N1, TARGET='_self', FOCEXEC=recursive(COUNTRY=CAR.ORIGIN.COUNTRY), $
ENDSTYLE
END

This message has been edited. Last edited by: Danny-SRL,


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

November 04, 2013, 07:48 AM
Dave
I don't know if there is a question in your post...

But here's another one:
DEFINE FILE CAR
	XCAR/A16 = IF COUNTRY EQ &COUNTRY THEN CAR ELSE '';
END

TABLE FILE CAR
	SUM	SALES
	BY	COUNTRY
	BY	XCAR
ON TABLE PCHOLD FORMAT HTML
END


...and another one...

TABLE FILE CAR
	SUM	SALES
	BY	COUNTRY
ON TABLE SET ASNAMES ON
ON TABLE HOLD AS H_COUNTRY
END

TABLE FILE CAR
	SUM	SALES
	BY	COUNTRY
	BY	CAR
WHERE COUNTRY EQ &COUNTRY
ON TABLE SET ASNAMES ON
ON TABLE HOLD AS H_CAR
END

MATCH FILE H_COUNTRY
	SUM	SALES AS 'CNTRY_SALES'
	BY	COUNTRY
RUN
FILE H_CAR
	SUM	ALL.SALES AS 'CAR_SALES'
	BY	COUNTRY
	BY	CAR
ON TABLE HOLD AS X OLD-OR-NEW
END

TABLE FILE X
	SUM COMPUTE SALES/D20 = IF FST.COUNTRY EQ &COUNTRY THEN CAR_SALES ELSE CNTRY_SALES;
	BY	COUNTRY
	BY	CAR
END


WebFocus : Inifite ways to skin a car


_____________________
WF: 8.0.0.9 > going 8.2.0.5
November 04, 2013, 09:28 AM
susannah
"skin a car"
ROFL




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
November 04, 2013, 09:41 AM
Dave
@susannah

It was actually a typo.. the R is next to the T. And 'we' type CAR alot more then CAT. :-) Just decided to leave it like that Big Grin


_____________________
WF: 8.0.0.9 > going 8.2.0.5
November 04, 2013, 11:26 AM
Danny-SRL
Dave,
There was no question, I was just sharing and maybe hoped for a more elegant solution.
As for what you suggest, I don't see the recursivity.


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

November 04, 2013, 03:46 PM
Waz
Looks pretty elegant to me.

Good One


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!

November 05, 2013, 01:08 AM
Danny-SRL
Thanks Waz.
Smiler


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

November 05, 2013, 02:05 AM
Dave
@Danny

I thought you were looking for another way to create the output...

...the recursivity needed no enhancements. :-)


_____________________
WF: 8.0.0.9 > going 8.2.0.5