How to move a DataTable argument beetween workflows

Hello UiPath community

I appreciate your help in this issue:

I have two workflows: 1. Main 2. Analysis

I have a datatable argument (out) declared in the Analysis workflow, and the same datatable argument is declared in the Main Workflow (in).

The issue I have is when I try to use write range in the main; because when UiPath try to do this activity, it pop ups a message saying that the datatable is null.

Inside the main I invoke the workflow Analysis and I verified that variables are correct:

I appreciate if you can help me finding why it is not working

First things first. You can read more about arguments here:

But the basics are this.
You always pass a variable as an argument. In this case, you want to have a variable of type DataTable in your main, that would be DTAccion. You can initialize it by giving it a default new System.Data.DataTable.

You can then pass it as an argument via Arugments window of your invoked workflow. Here is an example:

So you use your variable DTAccion from main and then say that within your Analysis workflow it should be referenced as an argument io_DTAccion.

For the direction, there are three possibilities:

  1. You want to ONLY pass it down to the workflow, then you use IN
  2. You want to ONLY extract it from the workflow, then you use OUT
  3. You want to BOTH pass it into the workflow, process it and pass it back to Main, then you use IN/OUT

But the direction needs to be the same for all places you declare your argument.

1 Like

I would also add that Arguments should not be declared in your Main. Arguments are only declared in the workflows that receive from or send back to the Main. “Variables” should be used in the Main and used to send to or store the values from the Workflows that you invoke.

So, the DataTable in the Main should be a variable, not an argument.