Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamic field name
Message
 
 
To
02/06/2005 10:50:56
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01019399
Message ID:
01019400
Views:
17
This message has been marked as the solution to the initial question of the thread.
See correction in the code below. Eval() should be faster than macrosubstitution in this case.

>I created a function that will check a condition on a field whose name is passed in. What is the correct syntax to get access to the data in that field?
>
>Below is the code that I am working with:
>
>parameters ls_field
>**ls_field is the field name that I need to test against
>
>select employee
>IF SEEK(thisform.r_cempcode)
>         ****** this is where I need the help **********
***	if employee.ls_field = "D"
	if EVAL("employee." + ls_field) = "D"
*Or
	if employee.&ls_field = "D"
>		if empty(thisform.r_days)
>			messagebox("Appropriate meddage")
>		endif
>	else
>		if empty(thisform.r_hours)
>			messagebox("Appropriate Meassage")
>		endif
>	endif
>endif
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform