Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reference a table field in code
Message
From
20/06/2005 04:13:27
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Pro
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01024763
Message ID:
01024766
Views:
83
This message has been marked as the solution to the initial question of the thread.
IIF(EVAL(("valn"+ALLTRIM(STR(mx)))) <> 0,"not zero","zero")
or
IIF(VAL(EVAL(("valn"+ALLTRIM(STR(mx))))) <> 0,"not zero","zero")
>hi all,
>I have a problem which i cannot understand as there seems to be a bit of a paradox in the code. I am using a table with 6 fields called valn1-valn6 (all are numeric 10,6), only the last digit changes. i have a loop in which a variable changes from 1-6 and i am trying to build up code so that i can run a condition on the contents of these fields. This code works fine, mx stores the value 1-6.
>
>BROWSE FIELDS ("valn"+ALLTRIM(STR(mx)))
>
>However this code returns "zero" even though on the row from above i can see the value as 5678. If i do not include the VAL of the string i get an operator/operand tye mismatch error which i through was odd given that the fields are all numeric
>
>IIF(VAL(("valn"+ALLTRIM(STR(mx)))) <> 0,"not zero","zero")
>
>any help/pointers much appreciated.
>Slán
>~M
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform