Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Field values from a variable
Message
De
16/09/1998 08:31:06
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00136777
Message ID:
00137220
Vues:
21
Snip..
>
>
>I'm taking data from xtab and inserting it into the other table the whole trouble lies in this section:
>
>
>lnATAFValue = EVAL('xtab.'+lcFName)
>lcATAFValue = STR(lnATAFValue)
>SELECT ATA_Report
>GO BOTTOM
>REPLACE &lcATAFName WITH TRIM(lcATAFValue)&& WILL NOT DO REPLACE
>
>The program won;t execute the REPLACE command. I have another FOR loop that does the same with numeric fields and it works (identical syntax). I find it a little strange and frustrating to be honest.
Perry,
I might have spotted the failure point. Not sure w/o knowing the structure of ATA_report (does it have char fields not large enough to hold num2char converted ?). While converting num to char you don't ltrim() thus ie: 1 converts to " 1" which might be longer than yout ATA_report field length. So if this could be the error point either :
lcATAFValue = STR(lnATAFValue)
* Change to
lcATAFValue = ltrim(STR(lnATAFValue))

* Or
REPLACE &lcATAFName WITH TRIM(lcATAFValue)
*change to
REPLACE (lcATAFName) WITH allTRIM(lcATAFValue) && () is better than & for name expressions.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform