Output Data Table formatting

I’m just getting started trying UIPath, and I am having an issue with the Output Data Table activity.

What I’m trying to do is to select a value from an input dialog, use that value in an SQL query, then use the results of the query as the options in another input dialog.

The query generates the results without any problems, and outputs to a datatable:


The input dialog options won’t take a datatable, though, only an array of strings. So, I am trying to use Output Data Table to make a string called outTable. This is where I’m having a problem. It outputs a string like this:
“ColumnName\r\nValue1 \r\nValue2 \r\n”

(I’ve limited it to two values, usually it’s about 25 values)

I want to make a new array of strings using outTable.Split(","C), but since there’s no commas it just makes an array of one big string containing all of the values.

Can anyone either help me figure out why Output Data Table isn’t using commas to separate the values or show me a better way to use the values in a datatable as the options for an input dialog?


Hi @dbuckalew

Since you don’t have any commas to split the string, you have to use the \r\n to do it. Try the below command. It works fine for me in such cases…

Variable.Split({"\r","\n"}, StringSplitOptions.RemoveEmptyEntries) 

This will return the result for the string “ColumnName\r\nValue1 \r\nValue2 \r\n” as

Just like you need in an array :slight_smile:

If this works for you, please make sure to mark the answer as the solution too :slight_smile:

Let know how it goes!!

Thank for the reply! You’re suggestion didn’t work, unfortunately. I think the /r/n are actual escape codes and the double quotes tries to interpret them as a string. I was able to to use the following, and it works:

outTable.Split(Environment.NewLine.ToArray, StringSplitOptions.RemoveEmptyEntries)

1 Like