03-21-2023 08:20 AM
So, I've been tinkering with running sequences in a new execution. My goal is to store a reference to the execution in a variable, which works pretty well with variables (locals in this case) which have been created during development.
In order to make things more complicated 🤔 I am creating the (local) variable for the reference dynamically during runtime using the API.
The issue comes up, when trying to dynamically assign the newely created variable as the storage for the exec refnum in the sequence call.
Note: the screenshot basically shows a fix variable name in order to make debugging easier. The Expression I am using is working. I am using the exact same expression in other places within my demo sequence (pls. refer to attachment).
When runing the sequence, the sequence call is executed without any run-time errors, the issue is that Locals.Sample_Exec_Ref is obviously not accessed by the sequence call, as can be observed by using breakpoints and inspecting the variables during runtime.
So... where do I go wrong here?
Cheers
Oli
Solved! Go to Solution.
03-21-2023 11:58 AM - edited 03-21-2023 12:02 PM
Will it work if you replace the method with the Evaluate() function?
BTW why do you need to use evaluate in the first place? The name is generated dynamically?
03-21-2023 01:57 PM
EvaluateEx() returns a reference object that refers to the result of the evaluation. To get to that result, deference the reference with a *. Example:
*ThisContext.AsPropertyObject.EvaluateEx("Locals.Same_ExecRef", 0)
03-22-2023 02:17 AM
James, thanks for clarifying this!
Questions like this can only come from a by-value guy 😅
I wasn't aware of the existence the dereference operator up to now!
For the records, I have attached the corrected version of the sequence file in case anybody wants to do similar complicated things.
03-22-2023 02:24 AM
@bienieck wrote:
Will it work if you replace the method with the Evaluate() function?
BTW why do you need to use evaluate in the first place? The name is generated dynamically?
Michal,
exactly, the name is to be created dynamically. I was using a fixed string to make the example easier.
Use case is the definition of custom step type, with which I want to make using new execs less error prone.