Challenge: Run PowerScript code stored in a string variable.
Limitation: The only object that can be imported into a library is DataWindow.
Who can do this?
Challenge: Run PowerScript code stored in a string variable.
Limitation: The only object that can be imported into a library is DataWindow.
Who can do this?
Hi Berka, thanks for clarifying details.
UPDATE: Added 4 more "PowerScript dynamic features"
All in all lots of ways to change behavior dynamically.
Only prerequisite: Code must be compiled prior to adding it to running app.
PowerScript is a compiled language, not interpreted unlike JavaScript. Therefore, you don't find Execute( ... ) to dynamically execute strings. ORCA is the technology that actually enables exactly what you are requesting.
Short of ORCA there are several ways to make code "dynamic" in different shapes and sizes:
In any case, I must stress using "very dynamic" coding techniques are potential security risks especially when you let user modify code as app is running. How will you do security analysis of code written while app is running?
HTH /Michael
If you want to use ORCA to import code objects, you are going to need several runtime DLL files that aren't normally part of the application runtime.
Also, because PB doesn't support call back functions, you cannot get any error messages if the import fails.
see evaluate under the describe notation.
also, functions can run from a pbl, so if you do import a function at runtime it would work
Hi Berka;
First of all you are correct .. the LibraryImport() method only supports DWO's. :-(
This command restriction was made by PowerSoft as they wanted to sell the ORCA API for profit. To make this so they crippled the LibraryImport command and then charged extra $$$ for the ORCA API. When Sybase made the ORCA API part of the PB product, they should have removed the LibraryImport command class restriction (IMHO). Then all PB developers could write "kool" utilities for PB! Just my $0.02.
I have done dynamic code PowerScript code before. However, the PB architecture is based on a "compiled" model vs say VB which is an "Interpretive" execution model. Since the DWO source can be imported at run time and the DWO supports dynamic expressions .. this is the way I have implemented this "dynamic PowerScript" feature in the past.
Food for thought. HTH
Regards ... Chris
Berka, a couple of clarifying questions to help me and others better understand what you are looking for.
What you are looking for may have severe security implications so I'm hesitant to just throw final answers at you without understanding your context.
Kindly, /Michael
NOTE: Object types beyond DataWindow can be imported via the ORCA API.