Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Handling Tables
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00868831
Message ID:
00869698
Vues:
11
If I understand you correctly, it can be done in one select.
SELECT * FROM (m.lcfil) ;
  ORDER BY Date ;
  INTO CURSOR temp
You can use < pre > and < /pre > tags (w/o spaces) to preserve code formatting.

>Thanks for all the time you spent! I think I get the concept. I was confused by the VFP Reference that says “avoid” use of the “&”, but after extensive trial & error, I found that I had to use the “&”. So, I thought I must not understand something. From what you say, use of the “&” macro concept is not only OK, but is essential in certain instances…Correct? If so,
>
>Here’s the successful VFP code I wrote to “invert” the data in a Yahoo download – data comes in with the most current data in the 1st row – I need it in the last . Downloaded table has two fields: Date & Value. Code is abbreviated & only refers to moving the data between the two tables.
>What I really want is to know how the code can be improved with respect to the use of the “&”. I apologize for the 1st transmission, as I did not see that there were no indents.
>
>Parameters m.lcfil &&name of table to be inverted, passed from elsewhere.
>SET MULTILOCKS ON
>SELECT 1  &&wk area a
>USE (lcfil)
>COPY STRUCTURE EXTENDED TO hdr
>SELECT 2
>USE hdr
>GO 2
>m.lcfldnm1=FIELD(5)
>replace &lcfldnm1 with .t.  &&makes new table accept null values
>CREATE temp from hdr
>ERASE hdr.dbf
>SELECT 2
>USE temp
>SELECT a
>m.lircdcnt=RECCOUNT(1)
>SELECT b
>FOR m.icnt = 1 TO m.lircdcnt
>    APPEND BLANK  &&puts blank recordes = number of table to be inverted
>ENDFOR
>GO top
>CURSORSETPROP("Buffering",5)
>SELECT a
>FOR m.lifldcnt = 1 TO FCOUNT()  && loop for each field in turn
>    GO bottom
>    DO WHILE m.lircdcnt => 1 &&  loop for each record in the field
>      m.lcfldnm1=FIELD(m.lifldcnt)
>      SELECT b
>      m.lcfldnm2=FIELD(m.lifldcnt)
>      replace &lcfldnm2 WITH a.&lcfldnm1  && accepted
>      SKIP 1
>      SELECT a
>      m.lircdcnt = m.lircdcnt - 1
>      SKIP -1
>    ENDDO
>    m.lircdcnt=RECCOUNT(1)
>    SELECT b
>    GO top
>    SELECT a
>ENDFOR
>Use
>Select b
>Tableupdate(.t.)
>Use
>Return
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform