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:
00869367
Vues:
18
Thanks so much for your help. I thought I’d impose again to state the “crux” of my problem.
I do modeling, which involves selecting fields from a number of tables and combining them in a master table. As a result, I need a way to “indirectly” refer to these fields so they can be found and then put in the master table. The old DOS, Clipper program I am now using does this easily with “macro” substitution and the table direction symbol “->”.

The below problem, involves “inverting” the values in one table to another, e.g., making the 1st record in one table the last in another and so on.

The bold text below is what happens when I used each of the replace commands in the code.
The VFP reference says to avoid the use of the “&” and use a () in its place, yet attempts to do that produce errors; and, use of the “&” seems to produce the most concise and cleanest code. What am I doing wrong?

PARAMETERS m.lcdir, m.lcfil
MESSAGEBOX("in yahinv")
CD (lcdir)
SET MULTILOCKS ON
m.liwkarea1=1
m.liwkarea2=2
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.
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
ENDFOR
GO top
CURSORSETPROP("Buffering",5)
SELECT a
FOR m.lifldcnt = 1 TO FCOUNT()
GO bottom
DO WHILE m.lircdcnt => 1
m.lcfldnm1=FIELD(m.lifldcnt)
SELECT b
m.lcfldnm2=FIELD(m.lifldcnt)
replace &lcfldnm2 WITH a.&lcfldnm1 && accepted
replace (lcfldnm2) WITH EVALUATE("a."+lcfldnm1) &&accepted
REPLACE (lcfldnm2) WITH (lcfldnm1) IN m.liwkarea1 &&accepted
replace (lcfldnm2) WITH a.(lcfldnm1) &&syntax error
replace b.lcfldnm2 WITH a.lcfldnm1 &&accepted,when executed can't find lcfldnm1&2
replace (b.lcfldnm2) WITH (a.lcfldnm1) &&accepted,when executed can't find lcfldnm1&2
WAIT "stop"
SKIP 1
SELECT a
m.lircdcnt = m.lircdcnt - 1
?m.lircdcnt
SKIP -1
ENDDO
m.lircdcnt=RECCOUNT(1)
SELECT b
GO top
SELECT a
WAIT "ready for next for loop"
ENDFOR
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform