I have been developing in UiPath for quite some time now but I still struggle to pass data (variables and arguments). It usually takes me a long time of trial/error before I figure it out.
I was wondering if someone could explain (or point me to an explanation) for how to pass variables/arguments out of one workflow, into the Main or Process (in Framework) workflow, and then into another invoked workflow.
For example, in the first workflow I am reading an excel sheet and creating a DataTable. I want that DataTable to be passed out of Workflow1 into the Process workflow. Then I want to pass that same DataTable from the Process workflow into the invoked Workflow2.
Thank you for the response. I have read that documentation and I do understand the different uses for arguments and variables. I think the part that confuses me is having to pass arguments from Workflow1 to Main to Workflow2, instead of just Workflow1 to Workflow2
In your case what you would need to do is create a variable of type datatable in your main workflow. This is so that your main workflow can hold the datatable that will be passed around. Lets call it myDt. Next in your “Workflow1” Do whatever logic is needed to get the datatable and assign in to an out variable called “outVarMyDt”. for verbosity
Back in your main Workflow when you implement the “invoke workflow file” activity and you click “import arguments”, you should see the out var from that process.
In the space that is labeled “value” you can assign any local variable to the output of this workflow. And guess what? You already have one just for this. Its called myDt! Lets fill that out.
Now, the outputted datatable from “Workflow1” is assigned to your variable called myDt.
If you want to pass this datatable to another workflow, create that workflow, lets call it “Workflow2” within that workflow create an input var called inputVarMyDt
Don’t forget to save your workflows before trying to invoke them, sometimes it can be frustrating when you click “import variables” and you don’t see the variables that you declared because you forgot to save the workflow file.