How to define column


#1

Hi,

I got quite easy question. If i got arrayStr and using add data row…then i put my arrayStr to Input: Array Row. But Where to define column for this arrayStr. For example now its goes to column name “1” but i want input this array to column “2” how to do that.

Many thanks for answer.
Regards
@fudi5


#2

Hi,

It should place each item of the array in the column position that is the same position in the array.
So, for example { “a”,“b”,“c” }, “a” will be put in column 1, “b” will be put in column 2, and so on.

If you want just one item put in the row, then leave empty strings in those positions.
Like, { “”, variable, “”, “” }

Does that answer your question?

Additional tips:

  • do a search for SetOrdinal. That will allow you to change the position of the column.
  • you can change the name of the column using an Assign activity and .ColumnName like row(0).ColumnName = “NewName”, and can be done in a loop if you have an array of strings

Regards.


#3

Hi @ClaytonM

Im not quite understand your advice because in my case output:
Output
Which is arrayStr goes to one column… and its generated by foreach loop.
But i need to ask again… can i put this to column 2 instead of column 1
To better view situation:

Regards,
And many thanks for you @ClaytonM
@fudi5


#4

Yes, sorry if I confused you.

Just use the text in the second position in the Array in your Add Data Row.
So it would be like { “”, EKW_III_3_2_3_4_all(0) }

…As long as there is a second column in the data table, which in the case the second column doesn’t exist, you also need an Add Column at some point before you try to add data row.

Regards.


#5

@fudi5
If you want you can Initialise the DataRow
By setting the Property DataRow to DataTableVariable.NewRow

Then you can Assign the value to the respective column by using Assign Activity.
Like item(“Column Name”)=Value.

Regards,
Mahesh


#6

Hehe. Great. I got more the one column in table but i thought about redirecting values form arraystr to another column the default column which is column with index0 right? One more question if i use

first column will be empty (coz “”) but if there are in rows some data in column one what then?
PS how to get title UiPath Graduate. I finished all training in UiPath.

Regards,
@fudi5