Focal Point
[SOLVED] Incremental Row Counter as the Leftmost Column on a Matrix Report

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

November 17, 2009, 11:51 AM
Vas
[SOLVED] Incremental Row Counter as the Leftmost Column on a Matrix Report
Firstly i would like to introduce myself to the forum as a newposter and thank you all of you guys for helping and supporting each other.

Problem description:
I want to have an incremental row counter as the leftmost column on my report output. The report has BY and ACROSS fields.
I searched extensively on the forum, i found many posts regarding 'row count' but some i could not understand ( Webfocus newbie) and others
gave me some useful tips that unfortunately didn't do the trick.

Some of the things i tried:

- I tried to use a compute field but report painter doesn't let me put a SUM field before a BY field.

-I tried the list sequence command.

-I tried to use stylesheets and i got error: (FOC3220) STYLESHEETS CAN NOT SEQUENCE 'ACROSS' OR 'OVER' COLUMNS
If i go to 'Source view' and i delete the across column which is automatically sequenced in stylesheet then all is ok! But the
next time i switch to GUI view the across column is automatically sequenced again. i.e.
TYPE=REPORT,
COLUMN=N4,
SEQUENCE=745,
It is crucial that i can access report painter Gui without limiting the already achieved functionality.

-I tried to use a hold file but messed it up



More accurate problem description:


The following code

 
TABLE FILE CAR
LIST
     CAR
BY COUNTRY
BY MODEL
ACROSS SEATS
END
 



produces this Output

but what i really want is Desired_output

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


WebFocus 7.69
Windows 2003
Db2 for Windows 9.5
November 17, 2009, 12:21 PM
Darin Lee
That's a common problem with the GUI. There are lot's of things that you can do in the code that the GUI doesn't understand so it just throws it out or makes a best guess as to what you "really" wanted to do. Probably the easiest way to get what you want is to use a multiverb set - the first to get the counter, the second to get the rest of the report.
TABLE FILE CAR
SUM
     COMPUTE ROWCNT/I9 = LAST ROWCNT + 1;
BY COUNTRY
BY MODEL
PRINT
     CAR
BY COUNTRY
BY MODEL
ACROSS SEATS
ON TABLE NOTOTAL
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     SQUEEZE=ON,
     ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
     GRID=OFF,
     FONT='TIMES NEW ROMAN',
     SIZE=10,
     COLOR='BLACK',
     BACKCOLOR='NONE',
     STYLE=NORMAL,
$
TYPE=REPORT, COLUMN=ROWCNT, SEQUENCE=1,$
ENDSTYLE
END


However, if you open this in the GUI the sequence gets thrown out.

Probably something you're going to have to live with to get what you need.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
November 18, 2009, 04:19 AM
Vas
Darin Lee thank you for your insights.

As i said customer needs access to the GUI, so imagine if every time they open up the report in report painter they have to modify code.

I understand and i trust you that this limitation is sth is have to come to terms with to achieve what i want.

It is just one of those important project requirements...so i have to find a way


WebFocus 7.69
Windows 2003
Db2 for Windows 9.5
November 18, 2009, 04:38 AM
Danny-SRL
Vas,

The following was created with the GUI:
  
TABLE FILE CAR
SUM 
     COMPUTE RC/I3 = RC + 1;
BY COUNTRY
BY CAR
SUM 
     SALES
BY COUNTRY
BY CAR
ACROSS SEATS
HEADING
""
FOOTING
""
ON TABLE SET PAGE-NUM OFF 
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     SQUEEZE=ON,
     ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
     GRID=OFF,
     FONT='ARIAL',
     SIZE=9,
$
TYPE=TITLE,
     STYLE=BOLD,
$
TYPE=TABHEADING,
     SIZE=12,
     STYLE=BOLD,
$
TYPE=TABFOOTING,
     SIZE=12,
     STYLE=BOLD,
$
TYPE=HEADING,
     SIZE=12,
     STYLE=BOLD,
$
TYPE=FOOTING,
     SIZE=12,
     STYLE=BOLD,
$
TYPE=SUBHEAD,
     SIZE=10,
     STYLE=BOLD,
$
TYPE=SUBFOOT,
     SIZE=10,
     STYLE=BOLD,
$
TYPE=SUBTOTAL,
     BACKCOLOR=RGB(210 210 210),
$
TYPE=ACROSSVALUE,
     SIZE=9,
$
TYPE=ACROSSTITLE,
     STYLE=BOLD,
$
TYPE=GRANDTOTAL,
     BACKCOLOR=RGB(210 210 210),
     STYLE=BOLD,
$
TYPE=REPORT,
     COLUMN=N1,
     SEQUENCE=2,
$
TYPE=REPORT,
     COLUMN=N2,
     SEQUENCE=3,
$
TYPE=REPORT,
     COLUMN=N3,
     SEQUENCE=1,
$
ENDSTYLE
END



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

November 18, 2009, 06:13 AM
Vas
Hey Danny!

Your post has helped me answer my question!!! Good One

When i first read your post i noticed that you use stylesheets too! So i was quite sure that as soon as i would open it up in GUI for a second time, the ordering of the columns would be changed again. Being very close to post that this doesn't work i decided to create a new report with your code in, just to confirm. To my surprise the stylesheet formatting was kept!

After digging in a bit more... Report->Options->Output->Custom Field Placement does the trick.



By the way, another way of implementing that it worked for me, was to make the 'outer by field' RANKED. This creates the incremental row counter that i want.
Not sure though what would the effect of declaring a 'by field' as Ranked be.
Any Advice on this?


People i really want to thank you all, those who have read this post and you that have contributed.
Thanks a lot Wink


WebFocus 7.69
Windows 2003
Db2 for Windows 9.5
November 18, 2009, 06:20 AM
Danny-SRL
Vas,

When you declare "RANKED" on a by field, the numbering will be incremented each time the field changes value. So if you have groups, you won't have a line numbering.

As for Custom field placement, you can do it easily by right-clicking the field you want to move and dragging it.


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