Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Running Code from memo field
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00330914
Message ID:
00331066
Vues:
15
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform