Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to set grouping in a worksheet
Message
De
23/10/2010 16:52:06
 
 
À
23/10/2010 10:19:48
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01486712
Message ID:
01486734
Vues:
50
>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 && for full report scope

   cGroup1=ClentCode

    && Here you are at group header1 point / show some heading 
   scan while ClentCode=cGroup1

         && group header2 point  
         cGroup2=ClentCode+ItemCode
        scan while  ClentCode+ItemCode = cGroup2
 
               
                 ** report detail
        

        endscan
        skip -1   &&fix nested scans pointer bug

        && Here you are 'sitting' on group 2 footer 
        && show some total or whatever      
 

   endscan
   skip -1
   && Here you are 'sitting' on group 1 footer ...
   && ...      


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
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform