Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Eval() Function Question 1

Status
Not open for further replies.

drosenkranz

Programmer
Sep 13, 2000
360
US
Hello,

I've got a set of mvars to store .T. or .F. if a value is found in the corresponding field which is constructed in Scan While loo . I can't quite get this to work. The hhmemsid field can be any number between 0 and 15. I need to capture which numbers are in use in the child table's (hhmems.hhmemsid)

&& Initialize logical vrbls
public gl_HHMemID1, gl_HHMemID2, gl_HHMemID3...
strore .F. to gl_HHMemID1, gl_HHMemID2, gl_HHMemID3...
*
locate for psformsid = gn_psformsid
do while psformid = gn_psformid and not eof()
lc_vrblname = EVALUATE("gl_HHMemID" + ALLTRIM(STR(hhmemsid))
&& hhmemsid is an integer field in the table EVALUATE("lc_vrblname") = .T.
&& This line fails - need to set gl_HHMemID?? = .T. (for all numbers found)
enddo

During the loop how can I set the memory variables (gl_HHMemID##) to .T. ?

Thanks,

Dave

The 2nd mouse gets the cheese.
 
DO WHILE psformid = gn_psformid AND !EOF()

lc_vrblname = "gl_HHMemID"+ALLTRIM(STR(hhmemsid))

IF &lc_vrblname && i.e. .T.
.. do whatever you want..
ENDIF

ENDDO

:)

ramani :)
(Subramanian.G)
 
Hi Ramani,

Thanks for the help.

Dave

The 2nd mouse gets the cheese.
 
Hi Again,

I need a little more help. I still come back to the same problem - Once I have built the variable name using
lc_vrblname = "gl_HHMemID"+ALLTRIM(STR(hhmemsid))
then how do I set that variable ( gl_HHMemID??) to .T.?

There could be 15 of them (gl_HHmemID1 to gl_HHMemID15), so I'd like to handle the assignment in a loop as opposed to If Then Else statements.

At the end, I just need to know which ID's were in that child table by setting the memory variables to true when one of the ID's is found. How do I set the variable gl_HHMemID?? (contained in lc_vrblname ) to .T. during the loop once I've built the variables name using the EVAL() function??

Thanks,

Dave

The 2nd mouse gets the cheese.
 
gl_hhmemsid1,2,3 etc are variables
hhmemsid1,2,3 are field names

FOR i=1 to n
cI = ALLT(STR(i))
gl_hhmemsid&cI = myTable.hhmemsid&cI
ENDFOR

Does this answer your question?

ramani :)
(Subramanian.G)
 
Ahhhh Ramani,

You never cease to amaze me.

Thanks for the ampersand(&) tip - it did the trick.

Dave

The 2nd mouse gets the cheese.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top