Focal Point
Displaying random multiple graphs on the same page

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

September 07, 2006, 05:27 PM
texascyclone
Displaying random multiple graphs on the same page
I thought about this for a while and I couldnt succeed to come with a working solution.

Here is an example:

TABLE FILE CAR
PRINT CAR
BY COUNTRY
WHERE COUNTRY EQ 'ENGLAND'
-----------------------------------------------
COUNTRY CAR
ENGLAND JAGUAR
JENSEN
TRIUMPH


-----------------------------------------------

Now I would like to display multiple graphs (4/page) depending on the cars in a country. So I will have 3 graphs for England, 1 for France etc(depending on the country input).

The idea was to have a loop and store the car value in a variable that will ultimately be a hold file to be used in html
(eg !IBI.FIL.&COUNTER). My main problem is determining the number of graphs to display since I will have to have the html code defined in advance.




.......
etc

!IBI.FIL.GRAPH1;


How will I determine the html code above in advance without knowing how many graphs I will have?

Thanks in advance.
September 07, 2006, 06:12 PM
Francis Mariani
Try running this code:
-SET &ECHO=ALL;

-SET &HOLDFNUM = 0;

TABLE FILE CAR
SUM COUNTRY BY COUNTRY
ON TABLE HOLD AS HOLDCO FORMAT ALPHA
END
-RUN

-SET &CO_LINES = &LINES;

-REPEAT ENDLOOP1A FOR &NCO FROM 1 TO &CO_LINES STEP 1;
-READ HOLDCO NOCLOSE &CO.A10.
-TYPE --- PROCESSING COUNTRY &CO
TABLE FILE CAR
SUM CAR BY CAR
WHERE COUNTRY EQ '&CO'
ON TABLE HOLD AS HOLDCA FORMAT ALPHA
END
-RUN

-SET &CA_LINES = &LINES;

-REPEAT ENDLOOP2A FOR &NCA FROM 1 TO &CA_LINES STEP 1;

-READ HOLDCA NOCLOSE &CA.A16.
-TYPE ---   PROCESSING CAR &CA
-SET &HOLDFNUM = &HOLDFNUM + 1;
TABLE FILE CAR
SUM SALES
BY COUNTRY
BY CAR
BY MODEL
WHERE COUNTRY EQ '&CO'
WHERE CAR EQ '&CA'
ON TABLE HOLD AS HOLDF&HOLDFNUM FORMAT HTMTABLE

ON TABLE SET PAGE NOPAGE
END
-RUN

-ENDLOOP2A

-ENDLOOP1A

-REPEAT ENDLOOP3A FOR &HFN FROM 1 TO &HOLDFNUM STEP 1;

-HTMLFORM BEGIN
!IBI.FIL.HOLDF&HFN;
-HTMLFORM END

-ENDLOOP3A
It loops through the COUNTRY values and the respective CAR values, creating a report for each. Then it creates one HTML page with all the reports embedded. I didn't create graphs and didn't create multiple pages.

This will work for HTML. If you require PDF output, try the looping suggested here along with Compound reporting.

I hope this put you in the right direction.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
September 08, 2006, 10:17 AM
texascyclone
Thanks Francis.

That showed me a couple of things that I can try to accomplish what I am doing.
September 10, 2006, 11:25 PM
susannah
tex,in a similar vein to what Francis has suggested,
I first determine how many grafs i'll have,
by preparing an extract file and counting something or other, &MAXKOUNTER ...
then prepare all my grafs, tables, and images in the agent, all numbered by some kounter

-SET &MYGRAF= 'HGRF' | &KOUNTER ;
GRAPH FILE HOLD
...
ON TABLE HOLD AS &MYGRAF FORMAT HTMTABLE
END
then loop thru the kounters from 1 up to their max value and dump them all out
-HTMLFORM BEGIN
<table>
-REPEAT somelabel &MAXKOUNTER TIMES
<tr><td>
<TD>!IBI.FIL.MYPIC1;
<TD>!IBI.FIL.MYTAB1;
<TD>!IBI.FIL.MYGRAF1;
</TR>
-somelabel
-HTMLFORM END

all sorts of wild variations on this theme are possible. but the key is that i prepare them all in the agent, then dump them all when done using HTMLFORM and lots of embededded DM inside the HTMLFORM. Give you any ideas?




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID