How to read the value of a process variable inside a sub process

266 views
Skip to first unread message

lto...@gmail.com

unread,
Jul 16, 2018, 2:16:55 PM7/16/18
to Fujitsu RunMyProcess Developer Community
I'm trying to read the value of an Array type variable defined in a MAIN process inside a sub process, with no success. The value of this variable can be viewed correctly through a Process Report in the "Initial Parameters" tab of all the sub processes that are created. I only have 1 web interface with multiple screens as recommended. The detail is that each screen is in a Custom Widget.
The variable is being added using "RMPApplication.set ("taskList", result)" with script in the action button responsible for starting the main process. To retrieve the value, I'm using "RMPApplication.get (" tasks ");" which returns NULL on the console.
"Send variables" and "Inject Results" options in the sub process are selected.
Could you help?

Pankaj Kumar

unread,
Jul 16, 2018, 6:15:46 PM7/16/18
to Fujitsu RunMyProcess Developer Community
Hi,

If you have the set the variable using "RMPApplication.set" method, you should access the variable with same variable name that you had given in "set" method. i.e   "RMPApplication.set ("taskList", result)" to access "result" variable please use  "RMPApplication.get (" taskList ")". This variable will be accessible only in main process not in "sub-process" (in case if you have selected " Nested process" variable will be available.)

Once you select the " Send variables" checkbox, you need to explicitly set the variable in sub-process input parameter tab that you want to send in sub-process. Please refer to below link and attached screen-print for reference:-


Thank you,
Pankaj Kumar
Fujitsu RunMyProcess Support


--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "Fujitsu RunMyProcess Developer Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum+unsubscribe@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at https://groups.google.com/a/runmyprocess.com/group/supportforum/.
To view this discussion on the web visit https://groups.google.com/a/runmyprocess.com/d/msgid/supportforum/d5826b0d-8f22-4c40-93af-7075fc3fe06c%40runmyprocess.com.
For more options, visit https://groups.google.com/a/runmyprocess.com/d/optout.

12943.PNG

lto...@gmail.com

unread,
Jul 17, 2018, 1:35:39 PM7/17/18
to Fujitsu RunMyProcess Developer Community
Em segunda-feira, 16 de julho de 2018 19:15:46 UTC-3, Pankaj Kumar escreveu:
> Hi,
>
>
> If you have the set the variable using "RMPApplication.set" method, you should access the variable with same variable name that you had given in "set" method. i.e 
>
>  "RMPApplication.set ("taskList", result)" to access "result" variable please use  "RMPApplication.get ("
>
> taskList
>
> ")". This variable will be accessible only in main process not in "sub-process" (in case if you have selected "
>
> Nested process" variable will be available.)
>
>
> Once you select the "
>
> Send variables" checkbox, you need to explicitly set the variable in sub-process input parameter tab that you want to send in sub-process. Please refer to below link and attached screen-print for reference:-
>
>
> http://docs.runmyprocess.com/Developer_Guide/Development_Environment/Toolbox/Processes/Step/Task/Process_Task_SubProcess_Tab
>
>
>
>
>
>
> Thank you,
> Pankaj Kumar
> Fujitsu RunMyProcess Support
>
>
> On Mon, Jul 16, 2018 at 11:46 PM, <lto...@gmail.com> wrote:
> I'm trying to read the value of an Array type variable defined in a MAIN process inside a sub process, with no success. The value of this variable can be viewed correctly through a Process Report in the "Initial Parameters" tab of all the sub processes that are created. I only have 1 web interface with multiple screens as recommended. The detail is that each screen is in a Custom Widget.
>
> The variable is being added using "RMPApplication.set ("taskList", result)" with script in the action button responsible for starting the main process. To retrieve the value, I'm using "RMPApplication.get (" tasks ");" which returns NULL on the console.
>
> "Send variables" and "Inject Results" options in the sub process are selected.
>
> Could you help?
>
>
>
> --
>
> Fujitsu - RunMyProcess
>
> ---
>
> You received this message because you are subscribed to the Google Groups "Fujitsu RunMyProcess Developer Community" group.
>
> To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
---------------------------------------------

Hi Pankaj. Thanks for answering.

You are correct on the way to obtain the variable value. It was a mistake from my side when copy/paste the example to prepare the e-mail message.

Unfortunately, I am still not able to make it work. I've attached a PDF file containing some screenshots from my project. Could you please, take a look and let me know if you find errors or something that is missing?

Basically, I suspect the problem is related with the fact that my variable is not available under "Parameters->Computed Parameters"

Regards,
Luiz Tomaz
subprocess.pdf

Pankaj Kumar

unread,
Jul 17, 2018, 5:02:54 PM7/17/18
to Fujitsu RunMyProcess Developer Community
Hi  Luiz,

In Process "Assigned Task" activity "input variable", please try "${taskList[P_index]}" instead of   "${taskList[P_index][0]}" since as per your screen-print "  ${taskList[P_index]}" is a JSON object instead of array. If you want to pass any specific property in sub-process, please use "." operator to access JSON object property.


Thank you,
Pankaj Kumar
Fujitsu RunMyProcess Support

lto...@gmail.com

unread,
Jul 17, 2018, 5:24:04 PM7/17/18
to Fujitsu RunMyProcess Developer Community
> To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
-------------------------

Hi Pankaj.
Thanks for answering!
I changed the input variable on SUB process to ${taskList[P_index]}.
The MAIN process continued to start normally and created multiple instances of the SUB process as expected - 10 instances, which looks fine.
However, the variables "taskList" and "tasks" remained as NULL and only visible under "Initial Parameters" and not on "Computed parameters" after checking on process report.
Any other clue? I can send another screenshot, if necessary.

Regards,
Luiz


Pankaj Kumar

unread,
Jul 17, 2018, 5:50:59 PM7/17/18
to Fujitsu RunMyProcess Developer Community
Hi  Luiz,

Are you accessing the variable "taskList" in same web-interface but inside sub-process activity? if yes, variable "taskList" is not available in sub-process as it is not passed in sub-process input parameter, however you can access variable "tasks". You need to pass the "taskList" variable in sub-process to access it in WI.

Thank you,
Pankaj Kumar
Fujitsu RunMyProcess Support

To unsubscribe from this group and stop receiving emails from it, send an email to supportforum+unsubscribe@runmyprocess.com.

To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at https://groups.google.com/a/runmyprocess.com/group/supportforum/.

lto...@gmail.com

unread,
Jul 17, 2018, 6:21:52 PM7/17/18
to Fujitsu RunMyProcess Developer Community
----------------------------------

Hi Pankaj,

The 'taskList' variable would be only for the loop that creates the instances of the SUB processes. I thought that, by setting this variable through the RMPApplication.set("taskList", result) command, it would be available for any SUB process of the MAIN process. However, it is not a problem for me that if it does not work this way.

The variable I need is 'tasks' which represents a set of filtered data from taskList and contains specific information for each SUB process.

I've just tried to just print the value of the variable within a SUB process activity and the value is also NULL.

Maybe I'm getting the value of the 'tasks' variable in the wrong way on my JS widget. I am using:

var t = RMPApplication.get("tasks");
console.log(t);

What would be the correct way to read and use the variable 'tasks' as it is supposed to be available within each of my SUB processes? Could you give me an example?

Thank you again for the help
Regards,
Luiz

lto...@gmail.com

unread,
Jul 18, 2018, 4:46:11 PM7/18/18
to Fujitsu RunMyProcess Developer Community, lto...@gmail.com
------------

Hello,
As a feedback... I could solve the issue by adding an input variable on SUB Process first activity - This is probably mandatory but I didn't know. :P
Now, I am able to read data from 'task' variable as expected. The variable is being displayed on Computed Parameters and can be accessed using ${tasks} anywhere.
Thanks for your support.
Regards,
Luiz Tomaz
Reply all
Reply to author
Forward
0 new messages