Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Running Code from memo field
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00330914
Message ID:
00331066
Views:
14
Each command in the memo file has to be delimited in some way (ie. [REPLACE mytable.... WITH xxx]) then you need a simple loop to parse and run each command with &. I used to store all logic for reports in memo files in the old days so I could make changes or additions without needing to recompile. Below is the code I used:

(as in the example above I used [] as my delimiters.)

codestr= STRTRAN(reporter.commands,CHR(13),'')
lpos= AT('[',codestr,1)
rpos= AT(']',codestr,1)
command= SUBSTR(codestr,lpos+1,rpos-2)
r__i= 2
parsing= .T.
DO WHILE parsing
&command && RUN THE COMMAND FOUND IN REPORTER.DBF
lpos= AT('[',codestr,r__i)
rpos= AT(']',codestr,r__i)
llen= (rpos - lpos) -1
IF lpos = 0
parsing= .F.
ELSE
command= SUBSTR(codestr,lpos+1,llen)
ENDIF
r__i= r__i + 1
ENDDO


Larry
www.TheProgrammerGuy.com
Larry Collins
TheProgrammerGuy.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform