Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cross Tab
Message
 
À
20/01/1999 08:37:24
Senna Dwipayana
Indo Rebel Apparel Cv
Bandung, Indonésie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00177691
Message ID:
00177966
Vues:
44
>As an example :
>Mytable1 crosstabbed to myTable2 and I want to change myTable2 into myTable3 with the same structure with myTable1 (because I changed some content on myTable2) and I think this also what you're trying to explain up there, but can you be more spesific ?
>
Hi Senna,

Here you go. Note, however, that this has not been debugged or tested, but it should work. It assumes the aliases are as you stated, and I've used "field1" to indicate the row values, "field2" for the column values, and "field3" for the value at the intersection. You'll have to modify it slightly, but it should do the job:
* Create the cursor to receive the data
SELECT MyTable1
= AFIELDS(a_fields)
* Note: If the table is not a free table
* modification of the array has to occur
* before the cursor can be created
* This could be used to create a table
CREATE CURSOR MyTable3 FROM ARRAY a_fields
SELECT MyTable2
lcalias = ALIAS()
lnfields = FCOUNT()
SCAN
  m.field1 = EVALUATE(FIELD(1))
  SELECT MyTable3
  FOR lni = 2 TO lnfields
    m.field2 = FIELD(lni, lcalias)
    m.field3 = EVALUATE(FIELD(lni, lclias))
    APPEND BLANK
    * Or individual REPLACE statements
    GATHER MEMVAR
  NEXT
ENDSCAN
hth,
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform