Hi all,
today I have the problem to pass values (string) from one apg process to another.
I use the feature to start "sub-processes" from a report script in a parent process like this (thanks to Tanguy Petre) :
var processAutoComp = Context.getComponent("Process");
var runresult = processAutoComp.run("5bdc5db1-fb79-11e3-4efe-00505692002f", PV_array);
That works fine and I pass the selected models I want to deal with to the sub-process I run with that command (PV_array) .
But I need to pass some additional parameter values (string) to the subprocess and I tried the context.setproperty und context.getproperty methods as we use it within other processes with reports (within one process - that's the difference). But the context-property I set in the calling process do not "arrive" in the second process when I try the getproperty - it is empty (null). It looks to me as if there are different contexts. Right?
How to deal with that and how can I manage to pass the parameters?
Many thanks for any idea.
Wolfgang
Hello Wolfang,
We had this issue also as indeed the instance context is different and the variables are instance dependant. What we did to overcome this was to store the parameters in the log database in an object specific to the first process and reread those parameters in the second process - you have then access to all variable you want.
Your PV_array could also contain a reference to the log object with all parameters. You process will start by first reading all variable and then start executing what needs to be done.
Cheers
Tanguy
Thanks again Tanguy! Very good idea.
The more I try I can see that I'm faced the same problems like others when I want to do some not-every-day tasks with APG. So it's very good to have the community here. :-)
This morning I received a phone call answer from an APG-expert who developed for our house some time ago. He told me the same like you about the context and made a similar suggestion (writing to an attribute in a model of the selection and read it later on).
So it's always a little bit tricky and not straight forward!
Thanks a lot and have a nice weekend.
Wolfgang