>Hi,
>I have a worksheet, have three columns and
> A B C
>1 Client Code Item No. Qty.
>2 AAA 1111 3
>3 AAA 1111 1
>4 AAA 2222 2
>5 BBB 1111 2
>6 BBB 1111 1
>7 BBB 2222 3
>8 BBB 2222 5
>
>How to set grouping to the worksheet as following result ?
>
> A B C
>1 Client Code Item No. Qty.
>2 AAA 1111 3
>3 AAA 1111 1
>4 tot: 4
>5 AAA 2222 2
>6 tot: 2
>7 BBB 1111 2
>8 BBB 1111 1
>9 tot: 3
>10 BBB 2222 3
>11 BBB 2222 5
>12 tot: 8
>
>How to coding ?
See rep2excel or CodeRep published here in downloads. There you have classes able to organize grouping that mimmicks
in full FRX style grouping while automating reports to excel.
In a more simple / straightfwd manner, you can do grouping using nested scans
Provided that table is sorted by ClentCode + ItemCode ;
local cGroup1,cGroup2
Scan
cGroup1=ClentCode
scan while ClentCode=cGroup1
cGroup2=ClentCode+ItemCode
scan while ClentCode+ItemCode = cGroup2
endscan
skip -1
endscan
skip -1
endscan
These are bare bones of implementing grouped reporting dataflow in code, as we used to do back in dos days.
What mentioned classes do, is more or less the same thing, just implemented recursively with variable number of group levels
and more generic.
The same reporting dataflow is featured as one of the samples in Report Sculptor as well. (See form sample #07)
HTH
Sergio