Passing Datatable using Launch Interactive workflow

datatable

#1

Hi,
I am passing a datatable in a invoke workflow and it is working fine. I just changed the invoke workflow to Launch interactive Workflow, it is not passing the datatable.

It is happening, when i pass SQL connection Object as well.


Run AutoHotkey Script
UiPath robot not stopping
#2

I’m able to pass the DataTable and get the row count in the Invoked WF, although DataRow can’t be passed in Interactive Workflow.

Are you getting any error message or you are able to access DT, but having issues with the datatypes?


#3

Have you tried to pass the datatable in launch interactive workflow. I am not getting any error, it just says number of columns as zero. where as, when i use invoke workflow, everything is fine.


#4

1st Arg works 2nd doesn’t


#5

What if you call the Main workflow with the Interactive from the start, then use the normal Invokes throughout the rest of your file? So you publish or create a file that all it really does is call Invoke Interactive or initialize some things, then everything else works as how you had it before.


#6

yeah, done that. Its working that way.


#7

Does “dt” initialized and have any columns? No, i am not gettng any error, it just the columns doesnt exist.


#8

I wonder if the Interactive creates a logon session and loses some variable types in the process, and that’s the reason.

:confused:


#9

Yeah, all the string arguments are passed with values, but not datatables and sql connection


#10

Hei,

Noticed that the DataTable is not passed if rowcount is 0. Add a dummy row and try again.


#11

LaunchWorkflowInteractive creates a separate robot process (same as InvokeWorkflowFile with Isolated = true). Whenever you’re passing things across process boundaries, they’re fully serialized and deserialized on the other side.
Since, as far as I know, Json serialization is used for that (specifically Newtonsoft’s implementation), there are some caveats with passing complex types (assuming they’re serializable at all).
For dt specific stuff you can check in this thread:

That’s correct. Only actual values are serialized and DT schema is inferred on deserialization based on first row values (or in other words - whatever you have in first row will dictate what Type that Column will have after deserialization). If you pass an empty DT, there’s no data to create columns from.

Just to repeat - from my knowledge this is not a UiPath specific error, it’s from Newtonsoft.Json.


Control not returning to main workflow after calling launch interactive workflow
#12

Any other way to smuggle this type of Variables? For eg: Keeping DT in list and Passing?


#13

In the topic I linked there’s a workaround with binary serialization. You could use other methods that could be more memory efficient, but for the use case back then the most important thing was keeping the structure intact. Whatever you do use, just don’t let Newtonsoft serialize it for you (that includes nesting it in other structures, as serialization is determined for each member type separately unless overriden).

It’s pretty straightforward to add a generic serialization/deserialization activities to make it easier to use across different types. They all still need to be [System.Serializable] though.

Alternatively, one could add custom Json converter for types needed… although I’m not sure how to inject it into argument serialization process without ripping things open.

For passing just the column schema (DT with no rows) there might be a different approach that escapes me currently. But binary serialization should (in theory) work with 0-row DT as well, as it gets the whole object anyway.
Do note that if one of the columns has a type that is not serializable, none of the above will work without further tinkering. But that’s another beast entirely.


#14

Thanks for detailed explanation. I will try the suggested ways.


#15

Hi there,
one of the other variable types, which is missed using Launch Workflow interactive is Terminal.Connection.

Thats make it hard to implement Launch Workflow interactive within Framework, where Terminal Connection is estabilished within Initialization State machine, and actual processing is done in other State machine.

If terminal is in place, we cannot work in interactive session.
Still Invoke Workflow file activity seems to be sufficient, but once it is not. Is there any workaround how to pass TerminalConnection to Interactively invoked workflow?


#16

Unfortunately - not really. You can only pass types that are serializable via LaunchInteractive and Invoke(with Isolated flag).

You might want to redesign your workflow to move to an interactive session sooner (f.e. as the first invoke directly in Main) and have everything in that. Seems to be working nicely.


#17

Thanks Andrzej,
does that mean, that if there is one Launch Interactive workflow file, then in that workflow there are just “invoked workflows” these are in fact interactive?

Solution might be Launch interactive workflow file - the whole Framework as-is?


#18

Pretty much, yes.
There might be corner cases to that with isolation inside isolation etc., but in general it seems to be working nicely to keep everything invoked down the line in interactive mode.