>Hello,
>
>I want to store a program (actually a 'create SQL View definition') with multiple commands in a memo field and then be able to execute it via the runtime module. Executing one program line works, but the multi-line program is trickier. I thought about going through the memo field line by line (checking for ';', etc.) but I was hoping there was an easier way.
ACtually, a CREATE SQL VIEW is a one liner, so it's pretty easy. Parsing more your code later for additional DBSETPROPs gets trickier, and if you need to do that, I would look into Randy Pearson's CodeBlock.
If you store your SQL Statement like:
CREATE SQL VIEW MyView AS ;
SELECT * ;
FROM MyTable ;
WHERE SomeField = ?SomeValue
You can process it with code like:
lcViewDef = CHRTRAN(lcViewDef, ";"+ CHR(10),"") && Remove all semi colons and linefeeds
lcViewDef = CHRTRAN(lcViewDef, CHR(13)," ") && Replace all hard returns with spaces
then you can execute the statement as one line:
&lcViewDef
BTW, this will all get easier in a few months when he COMPILE command is available at runtime. This is no longer a rumor.
Erik Moore
Clientelligence