Test Activity - How to pass DATATABLE

Hi All,

Let’s say i have a activity with datatable passed in, how can i test this activity individually?

i know if it is a STRING varibale, i can edit it from local panel, but what about DATATABLE ?

Kindly share your thoughts, thanks.

1 Like

Hi @pitaty

I think you are asking how to see your data table, if so then you can do that with Output data table activity and write to writeline and then check in the output panel.

Let me know if this is what asked.

Thanks for your attention.
Actually, what if i don’t want to output the datatable, there’s an activity used the datatable as input. Now i want to test the activity individually, but it tells me to give the input datatable. How can i do that?

image like this scenario

I would like you to answer below questions so that I can get clarity -

  1. Which activity you want to test?

You can give input data table from input property of that activity.

I can give better solution once you clarify the scenario in detail.

please see above pic as scenario. you can also think as this: if you invoke a xaml file with DATATABLE argument, how can you run this xaml file individually? in want to pass the DATATABLE into xaml file, but don’t want to run other xaml file to gererate.

To run it individually, you can just run directly From run icon or F5 button.
In output data table activity provide a string variable in property panel and write It to writeline to check the output.

Hi @pitaty
I think you can want to check whether the datatable is generated. If so use datatable.Columns.Count.ToString if the count is >0 then the datatable is generated.

Hope it helps :slight_smile:

but how to get the input datatable if you only run “Output Data Table” activity?

thanks. I want to ouput the actual data, how can i only run “Ouput Data Table” to achieve this purpose?

@pitaty
Check this

hey @pitaty,

As i know, basically it writes a DataTable to a string variable is the only use of Ouput Data Table activity, So you need to have DataTable variable to use Ouput Data Table, if you don’t wanna use generate datatable while testing Ouput Data Table there are other option like

  1. you can use Build Data Table to create datatable of data.
  2. you can use read range on excel sheet and have that data in your datatable.

And after one of these activity you can use Ouput Data Table to convert that data of the DataTable variable into string.

where you get the input “dt” ?

so, i need to add a step to fake data right?

if the variable if a string, i can fake a data directly in local panel, but if the variable is a datatable, i can’t do that right?

@pitaty

firstly take build data table activity, click on DataTable button in the activity body then it’ll expand (as shown in below shot) which enables you to customize the table to be created.
And create output variable as I told you before.

Now you can use Output Data Table activity and pass output variable of the build datatable in output datatable activity as Input and create output variable in the same activity of type string to get datatable in that str variable. So once you have string type you can use activities MessageBox OR LogMessage Or writeLine to display it. for that pass output variable of Output DataTable in Text parameter of the messageBox.

here’s the workflow if you need it —> Pract.xaml (6.8 KB) :slightly_smiling_face:

Thanks. Is there other way for us to get the datatable withour Build datatable, only test output activity?
any idea? if the function doesn’t exist within UiPath is also okay, just want to know the possibility.

Without any activity if you use Output dataTable by giving empty datatable variable, it’ll give you string with nothing.
Just comment build datatable activity and run you’ll see the output as given below.

got it, thank you ~