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:
- Use PB IDE to alter code after original compile time; then apply modified/new code at runtime.
- Use SetLibraryList to modify library list at runtime.
Add libraries and/or change sequence in the library list.
- Deliver some source code PBL files along with your app.
Allows users to modify a subset of classes and DataWindow objects.
- Deliver full app as source code so end-user or third-party can modify everything.
- Use dynamic linking/late binding of external code - albeit these are not PowerScript
- Any C# assembly loaded using new C# interop in PB 2019 R2
- Any COM object referenced via OLEObject
- Any external function call
- Any stored procedure or user-defined function
- User PowerScript dynamic features
- Call events using TriggerEvent/PostEvent - event name is text.
- Call methods using DYNAMIC - late binding at runtime. Watch for exceptions.
- Use Describe( "Evaluate( ... )" ) in DataWindow/DataStore.
- Create DataWindow objects from scratch - full syntax is text.
- Use string variable to determine DataWindow object name.
- Use string variable to determine DataWindow column name.
- CREATE USING "..." to create any class on demand.
- Open/OpenWithParm "syntax 2" to open any window class on demand.
- OpenSheet/OpenSheetWithParm "syntax 2" to open any window class as a sheet on demand.
- OpenTab/OpenTabWithParm "syntax 2" to open any tab page on demand.
- OpenUserObject/OpenUserObjectWithParm "syntax 2" to open any visual user object on demand.
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