Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Making a 'grid' table
Message
De
29/05/1998 10:32:53
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00102892
Message ID:
00103096
Vues:
17
>Hi all,
>
>I need to make a table into a grid. (Not as in the thing you put on a form). This would have zones running down the left, ie. the first field of each record is a different zone. Then it would have those same zones running across the top, ie. the field names would be each zone, except for the first one.
>
>The problem is that at design time I don't know what the zones are. Doing the left side is easy, just append a record for each zone. But doing the field names is something I don't know how to do programatically.
>
>Or am I going about this all wrong? What I want is to take, say, Z1 and Z2 and go to where they intersect to find the price. Like a multiplication table.
>
>Any ideas on how I should do this?
>
>Thanks,

Cross-tabulation will allow you to make following transition:
Source Table structure:
1. ZoneName1
2. ZoneName2
3. Fare
i.e. you have three field records:
z1 z2 35.80
z2 z1 35.80
z1 z3 67.00
z3 z1 67.00
z2 z3 15.00
z3 z2 15.00
etc.

Output Table structure, if you use ZoneName1 as rowfield and ZoneName2 as columnfield:
1. ZoneName1
2. z1
3. z2
4. z3
.... depending how many distinct ZoneName2 you have in source table
i.e. you have cross-field filled by fares
Zone Name Z1 Z2 Z3
Z1 0 35.80 67.00
Z2 35.80 0 15.00
Z3 67.00 15.00 0

Is it what are looking for?
Edward Pikman
Independent Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform