Not sure what you're saying about the aspect of making up a table from a csv file, but taken that for granted, of course you can also run a newly generated script from within an EXE, instead of saving as PRG use it as the code script parameter of EXECSCRIPT. It does nothing else as you do, though, it creates a prg and runs it. But it does that for you, and it cleans up after executing, so the prg/fxp files generated are in temp. You can also save a prg and do it, but EXECSCRIPT is made for that. Besides the script you can pass in parameters, which will need a LPARAMETERS withint the script, and when your script ends in RETURN that is it's return value. So you can see this as inline function, kind of. I wonder if it's really necessary in your case, but to show how this aspect works, too:
Code:
nSum = Execscript("Lparameters tnOP1, tnOP2"+chr(13)+"Return tnOP1+tnOP2",1,2)
Which compares to having a PRG Addition.prg:
Code:
Lparameters tnOP1, tnOP2
Return tnOP1+tnOP2
and call that via:
Now since you can also build up the script in a string variable or store the script in a memo field, you can have your dynamically created prg, but for executing a single CREATE TABLE or CREATE CURSOR you would neither need LPARAMETERS nor RETURN, you only execute one line of code and that can also be done with macro substitution, eg
Code:
lcSQL="CREATE CURSOR crsTest (iid I, cText C(20))"
[highlight #FCE94F]&lcSQL[/highlight]
or since the first part of it is constant and only the field composition changes, you can do:
Code:
lcFields="iid I, cText C(20)" && put together from analyzing a CSV file
[highlight #FCE94F]CREATE CURSOR crsTest (&lcFields)[/highlight]
Bye, Olaf.