Focal Point
[SOLVED] Compound Excel reports using template

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

September 03, 2009, 06:03 PM
<Kev>
[SOLVED] Compound Excel reports using template
I did a bit of searching, but couldn't find any satisfying answer to my issue. What I'm trying to do is generate a compound report (having three different tables) on a particular sheet of the template. This data will eventually be used by another sheet in the template, hence the template approach.
So, I'm trying to do something like following, but syntax doesn't work.
  
TABLE T1
PRINT *
ON TABLE PCHOLD FORMAT EXL2K NOBREAK
END

TABLE T2
PRINT *
ON TABLE HOLD AS TMPLT2 FORMAT EXL2K TEMPLATE 'TMPLT' SHEETNUMBER 1 CLOSE
END


If you feel I can tackle this better with a different approach, then please go ahead and suggest.

Thanks in advance.

This message has been edited. Last edited by: Kerry,
September 04, 2009, 02:43 AM
<JG>
Kev there have been several threads regarding EXL2K TEMPLATE over the last month or so
so I'm very surprised that you say you can not find anything.

I would search again.

Particularly with regards to how to actually use templates which you do not seem to know.

But the basic for EXL2K compound template output is
your template must be applied to the first output and that must be used as
the template for the subsequent output
September 04, 2009, 02:50 AM
Tony A
Kev,

You are trying to use compound (old style) reporting with a template and that just will not work.

Unless you can manage to combine your data into one manageable output then the single page output to template approach will not work. You would have to resort to outputting to two or more sheets.

The first question you have to ask yourself is how the combined data output from the compound portion of your code will be used? Are they in the same or similar formats - e.g. same number and formats of columns from two or more data sources?

For instance, if your data is designed to be one source within your excel file but comes from different data sources then something like this should achieve the single output that can be placed into a single sheet of a template -

APP PREPENDPATH IBISAMP
FILEDEF TEMPHLD1 DISK TEMPHLD1.FTM (APPEND
-RUN
TABLE FILE CAR
SUM COUNTRY/A30
    RCOST/D20.2
    DCOST/D20.2
 BY COUNTRY NOPRINT
ON TABLE HOLD AS TEMPHLD1 FORMAT ALPHA
END
TABLE FILE GGSALES
SUM REGION/A30
    DOLLARS/D20.2
    BUDDOLLARS/D20.2
 BY REGION NOPRINT
ON TABLE SAVE AS TEMPHLD1
END
TABLE FILE TEMPHLD1
PRINT *
END

This is a very simplistic form but the idea could be expanded to suit very many requirements.

If your requirement is data side by side then, again, use your imagination on how to achieve a single output -
APP PREPENDPATH IBISAMP
DEFINE FILE CAR
  SORTFLD/A30                 = COUNTRY;
  DCOST/D20.2                 = DEALER_COST;
  RCOST/D20.2                 = RETAIL_COST;
  DOLLARS/D20.2    MISSING ON = MISSING;
  BUDDOLLARS/D20.2 MISSING ON = MISSING;
END
DEFINE FILE GGSALES
  SORTFLD/A30            = REGION;
  DCOST/D20.2 MISSING ON = MISSING;
  RCOST/D20.2 MISSING ON = MISSING;
  DOLLARS/D20.2          = DOLLARS;
  BUDDOLLARS/D20.2       = BUDDOLLARS;
END
MATCH FILE CAR
SUM RCOST
    DCOST
    DOLLARS
    BUDDOLLARS
 BY SORTFLD
RUN
FILE GGSALES
SUM RCOST
    DCOST
    DOLLARS
    BUDDOLLARS
 BY SORTFLD
AFTER MATCH HOLD AS TEMPHLD1 OLD-OR-NEW
END
TABLE FILE TEMPHLD1
PRINT *
END

The answer is out there (I am sure that I've posted this sort of idea before) or think outside the box.

T

This message has been edited. Last edited by: Tony A,



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
September 04, 2009, 09:50 AM
GrEaT_DeBaTe
Kev,

Have you tried the OPEN command:


TABLE T1
PRINT *
ON TABLE PCHOLD FORMAT EXL2K OPEN
END

TABLE T2
PRINT *
ON TABLE PCHOLD FORMAT EXL2K CLOSE
END


7.6.4
windows
Excel2k and HTML.
September 04, 2009, 09:51 AM
<JG>
GrEaT_DeBaTeOPEN is not resolve Kev's basic problem.

When creating a compound EXL2K TEMPLATE output you cannot use compound syntax of any sort.

An EXL2K TEMPLATE compound document is a pseudo compound document,
created, as both Tony and I have said above.
Subsequent outputs have to use the previous output as their template.
September 04, 2009, 10:33 AM
<Kev>
JG & Tony,
The intuition behind my flawed syntax is: ouput of T1 is held on (until `CLOSE' is encountered) so that output of T2 is appended right after on the template sheet. I confess it's completely experimental. If I output on same sheet, it overwrites earlier output .
I've used templates earlier to capture full power of VBA, but have needed to output only one table per sheet.
For this case, however, two or more unidentical (one with three columns(A10, D20.2, A5), second with two columns (D10.2, A5), and so on...) need to be captured on one sheet.
I could output these tables on different sheets and use VBA to stick 'em together, but I'm looking for a better solution than that.

Thanks!
September 05, 2009, 02:52 AM
<JG>
Kev,

If you want vertical data added and new sheets you can use compound.
However if you want columns added then the only option is template and macro.
September 07, 2009, 02:17 AM
Tony A
quote:
For this case, however, two or more unidentical ............ need to be captured on one sheet.
Do they need to be vertically above one another, column one lining up with column one? If not then you could use either of my suggestions above. If they have to align then perhaps you could think about using FTOA etc to convert the columns so that you could use the suggestions?

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
September 11, 2009, 11:52 AM
<Kev>
I went ahead with the suggested route by Expert Tony, and am all set.

Thanks!