How to import and export a variable from one process to another

Dear UiPathers

I am curious how to import and export a variable from one process to another.

Imagine this, I have two processes, one called “main” and another called “process1”. In my main I have a simple string called myText “This is a text from main”, how do I import that into “process1” and save it to a variable in “process1” such that the string is being executed inside process1?

Now, also imagine I have another variable in “process1”, an integer, myInt, with the value “69”, how do I export that variable to “main” and save it in a variable such that I in main can print it like “myInt.ToString”?

Important information, I ONLY want to use ONE invoke workflowprocess, and that has to be in “main”. So “main” invokes “process1” and not the other way around. “process1” should not have an invoke workflow activity.

Below is two screenshots which shows my attempt of dealing with this dilemma:

MAIN

process1

@nmjvk

Use arguments to pass variables from one process to another.

Hi @nmjvk

Click on the import arguments and there you can see the arguments and please assign the correct variable to the repective argument.

Regards

Can you ellaborate on this?

Hi @nmjvk

Click on the invoke arguments and then you will be able to see the in_myText in the popup and then in the right side you will be able to see the blank cell and then enter the myText variable in that row and that’s it close the popup and save the workflow. In this way you can assign the variables and the arguments.





After assigning that please click on OK and save the workflow and then you will be able to get the data in process xaml.
Regards

Perfect. Can you now show how to output the argument myInt which is an integer of the value 69 back to Main?

Here is what I am trying to do in Main, but it does not work. I get “0” back when it should be “69”

Main

process1

Hi @nmjvk

You need to create and argument in the process xaml and keep the argument type as out and save the workflow and now access the main xaml and click on the invoke and assign the myint argument to myint variable in the main xaml and then you can get the value from process xaml to main xaml. keep a message box in the main xaml as shown below and print the int value in the main xaml.





Click on okay and run the workflow.

Regards

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.