Focal Point
[CLOSED] Question on a Loop for Mini-fiscal Year Report

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

October 26, 2010, 04:58 PM
Tomsweb
[CLOSED] Question on a Loop for Mini-fiscal Year Report
I am working with summary tables from a relational database.
An example synonym file layout is:

FILENAME=AGEGRP_11_A, SUFFIX=SQLMSS , $
SEGMENT=AGEGRP_11_A, SEGTYPE=S0, $
FIELDNAME=AGEGRP, ALIAS=AGEGRP, USAGE=A60, ACTUAL=A60,
MISSING=ON, $
FIELDNAME=_TYPE_, ALIAS=_TYPE_, USAGE=D20.2, ACTUAL=D8,
MISSING=ON, $
FIELDNAME=JUL10, ALIAS=jul10, USAGE=D20.2, ACTUAL=D8,
MISSING=ON, $
FIELDNAME=AUG10, ALIAS=aug10, USAGE=D20.2, ACTUAL=D8,
MISSING=ON, $
FIELDNAME=SEP10, ALIAS=sep10, USAGE=D20.2, ACTUAL=D8,
MISSING=ON, $
FIELDNAME=OCT10, ALIAS=oct10, USAGE=D20.2, ACTUAL=D8,
MISSING=ON, $
FIELDNAME=NOV10, ALIAS=nov10, USAGE=D20.2, ACTUAL=D8,
MISSING=ON, $
FIELDNAME=DEC10, ALIAS=dec10, USAGE=D20.2, ACTUAL=D8,
MISSING=ON, $
FIELDNAME=JAN11, ALIAS=jan11, USAGE=D20.2, ACTUAL=D8,
MISSING=ON, $
FIELDNAME=FEB11, ALIAS=feb11, USAGE=D20.2, ACTUAL=D8,
MISSING=ON, $
FIELDNAME=MAR11, ALIAS=mar11, USAGE=D20.2, ACTUAL=D8,
MISSING=ON, $
FIELDNAME=APR11, ALIAS=apr11, USAGE=D20.2, ACTUAL=D8,
MISSING=ON, $
FIELDNAME=MAY11, ALIAS=may11, USAGE=D20.2, ACTUAL=D8,
MISSING=ON, $
FIELDNAME=JUN11, ALIAS=jun11, USAGE=D20.2, ACTUAL=D8,
MISSING=ON, $

The MNYY fields (i.e. JUL10) contains monetary value (i.e. $23,000)
for that month, and the elements cover an entire fiscal year.

I am trying to create a report which will loop thru the data file
and select the correct no. of MMYY fields to display in a report if
the report is requested prior to the end of the fiscal year.

I have been trying to code a fex using the CHECK FILE command:

quote:

CHECK FILE AGEGRP_11_A HOLD
-RUN


but I'm not getting far. Frowner Any ideas?

quote:

CHECK FILE AGEGRP_11_A HOLD
-RUN

TABLE FILE HOLD
PRINT FIELDNAME
BY FIELDNAME NOPRINT
WHERE SEGNO EQ 1
ON TABLE SAVE
END
-RUN

TABLE FILE AGEGRP_11_A
SUM
-READ SAVE &Fieldname.A66
-*
-REPEAT :Loop WHILE &IORETURN EQ 0;
-*
&Fieldname
-READ SAVE &Fieldname.A66

-:Loop
END
-RUN


Thanks!

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


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
October 26, 2010, 05:17 PM
dbeagan
We are in the fourth fiscal month so right now you would like your report to:

 
TABLE FILE AGEGRP_11_A
SUM JUL10 AUG10 SEP10 OCT10
...
END


Is that what you are getting at?


WebFOCUS 8.2.06
October 26, 2010, 05:27 PM
Waz
Assuming the last 12 fields are needed, the financial year, then this may work.

CHECK FILE AGEGRP_11_A HOLD
-RUN

TABLE FILE HOLD
PRINT FIELDNAME
BY FLDNO NOPRINT
WHERE SEGNO EQ 1
WHERE FLDNO GE 3
ON TABLE SAVE AS FY_COLS
END
-RUN

TABLE FILE AGEGRP_11_A
SUM
-INCLUDE FY_COLS
END
-RUN


If the last 12 will not work, then you may be able to try another method, like filtering on the format, USAGE EQ 'D12.2'. You filter on the field names. FIELDNAME LIKE 'JUL%' OR ....


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!