Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Table Driven Field Replace
Message
 
 
À
11/04/2007 16:34:44
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Divers
Thread ID:
01214702
Message ID:
01214708
Vues:
7
>I am trying to put a field name in a table, then scan through the table and do a replace but I keep getting the Variable not found error for &rpl. Any Suggestions??
>
>SET SAFETY OFF
>SET STEP ON
>SELECT LXPOS
>GOTO TOP
>SCAN WHILE ! EOF()
>rpl = ''
>drpl = ''
>rpl = ALLTRIM(LXPOS.XDATA) &&The Actual Data
>drpl = ALLTRIM(LXPOS.XFIELD)   && The table and field I am trying to replace
>REPLACE &drpl WITH &rpl
>ENDSCAN
I just did it again! I again updated your reply when I should have posted mine as a separate reply.

Ok, just in case I repeat my answer:
Remove table alias from the drpl, use IN construct, e.g.
lcFieldToReplace = justext(alltrim(LxsPos.xField))
lcTable = juststem(alltrim(LxsPos.xField))

replace (m.lFieldToReplace) with rpl in (m.lcTable)
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform