Invoking data table made in an invoked workflow

I am trying to build my project in a different way to optimize performance but I’m running into an issue.

What I have now is a workflow that scrapes a table from a website, outputs it as a new data table, and then writes that table to an excel file. In the next workflow (which is invoked), I open up that excel file and read range to a new data table. I then run my operations on that data table and write the updated info back to the excel sheet

I’m trying to eliminate the excel sheet until I am done with the operations so I can write the whole table back at once, not piece by piece to the file on each iteration.

The issue I am running into is that in workflow1 (named for convenience) the data table that is generated (and that I would normally write to an excel file) is not in the global scope and won’t let me change it. I tried to pass it into workflow2 as an import argument but it isn’t showing up in the available variables.

Summary, the data table created in workflow1 is not showing up as an argument to import into workflow2

If I was unclear please let me know so I can try to explain it further.

Thank you for any help given

Did u keep the the data table in the arguments section of work flow 1 to pass into the workflow 2,and please whether you have kept the data table as out argument…
Let me know any doubts

Hi @Kriptiko,

Can you please share a screenshot of the argument list of Workflow 2 and the mapping between Workflow 1 and 2?

swimmerSet, Gender, and IsTeam are pretty self explanatory as they are variables passed from the first part of the workflow. tempDataTable is a global data table I have set up is used in this workflow. both swimmerSet and swimmerGender are imported through both 1 and 2

As far as mapping between 1 and 2 goes, the only thing that 2 does is open up an excel file created at the end of 1.

^That’s me trying to explain the relationship because I don’t understand what you mean by mapping

Can you please share the arguments in your work flow 1 and 2 not from import arguments, in the workflow or can you upload your xaml file so i can resolve it.

Workflow 1

Workflow 2

You are exporting tempDataTable from workflow 1 to workflow 2 right…Then you have to keep it as out argument in the workflow…

No actually tempDataTable is a data table I set in the main file and kept the scope as the whole project. I’m trying to get a table generated in workflow 1 into workflow 2 so that I may run my operations on that as opposed to an excel file

If you want to get a table generated in work flow 1 you have export it for sure…Once export and try…

@Kriptiko - you should structure it like this.

Main workflow (one you have screenshot of) - scrapes datatable from website and saves to a datatable variable titled dt1. It goes through and eventually invokes Workflow1

Workflow1 - this needs an in/out datatable argument. We’ll call this io_dt1 in workflow 1. Make sure to set the value of dt1 from Main to io_dt1 in the import arguments window.

Workflow2 - this needs either an in datatable argument, or an in/out datatable argument depending if data needs to be passed back to Main, or if the workflow just ends at this point. Make sure to set the value of dt1 from Main to this new in or in/out argument in Workflow2 import arguments window

EDIT: Just re-read your comment. If it is generated in workflow1, then you should set it as an out_argument in workflow1. All other information remains the same

the datatable is made in workflow 1, not the main one. The scraping happens in workflow 1 and thats where dt1 would come from. I need to be able to use dt1 in workflow 2.

@Kriptiko - check the edit. Everything else remains the same. Main should have a variable, Workflow1 should have an out_argument. Workflow2 should have an in_argument.

So you create the datatable in Workflow1 and save it to the out_argument we’ll call out_dt1. In the main workflow click “import arguments” on Workflow1 and assign out_dt1 to the dt1 datatable variable. In the main workflow click “import arguments” on Workflow2 and assign in_dt1 to the dt1 datatable variable.

This creates the datatable in workflow1 and passes it to main. Then main passes the variable into workflow2 where it is used for processing

Hi @Kriptiko

You need to set 3 DataTables in Main, Workflow1 and Workflow2 as In/Out arguments and set them as part of the Invoke Workflow File activity. The way it is currently setup, anything you need to pass from Workflow1 to Workflow2 has to flow through Main. It looks something like this -

Main -> Workflow1 -> Main -> Workflow2

Here is a sample

Workflow1.xaml (4.4 KB) Workflow2.xaml (4.4 KB) Main.xaml (9.0 KB)

You can always change this to invoke Workflow2 from within Workflow1 to make the sequence like this

Main -> Workflow1 -> Workflow2

In this case, Main will have an Out argument, Workflow1 will have an In/Out and Workflow2, an In argument. Here is a sample -

Workflow1.xaml (5.0 KB) Workflow2.xaml (4.1 KB) Main.xaml (6.5 KB)

In that case, the simplest thing would be to invoke Workflow2 from within Workflow1 and pass the DataTable as an argument rather than invoking it from Main (as long as you don’t require the DataTable in Main for processing later)

@goodoldme - it’s generally best practice to avoid invoking a workflow within a workflow whenever possible as this makes the project much harder to follow without really digging into it

@Dave i followed your exact steps but when I go to click “import arguments” on either workflow, out/in_dt doesn’t show up anywhere

Agree, @Dave. :+1:t4: I guess it’s a matter of convenience vs. maintainability/readaibilty. :slight_smile:

@Kriptiko Can you show me 5 screenshots total and make sure the datatable object we’re referencing is always visible for each of the below screenshots

  1. The variable pane in main
  2. The arguments pane in workflow1
  3. The arguments pop-up window when you click “import arguments” for workflow1 within main
  4. The arguments pane in workflow2
  5. The arguments pop-up window when you click “import arguments” for workflow2 within main.

I ask this so i can give concrete directions on why it’s not working.

I’ve decided to revert to how it was before. It’s really not making as big a difference in performance as I once assumed. Thank you all for the input, I’m sure it will help me in future projects