DataRow Array Creation or Another Method

I´d need to create an array of datarows and later on i need to pass every individual cell value to another system.
What would be best approach. I need all these values in example file so datarow items should be strings. There are numbers and text mixed in each row. Would be great if i dont need to create row array variable from each row. There are about 60 of them in total. :slight_smile:

Create and list of data row. By using add to list function.

1 Like

Started with this using add to collection approach. Downside is that i end up with too many list variables… :slight_smile:

Yeah that is expected when you have numerous rows.

1 Like

So i try to do this task smarter way. Now i have managed to get row item to string variable in a format i want. Next step would be to create array of each row.

Source Data after string manipulation
208352865,loremlipsum,221420,742151976,1,loremlipsum,81241337453,1,loremlipsum,74211755962,1,Loremlipsum,8201600378,1,Loremlipsum,7711755964,1,Loremlipsum,7711451976,1,Loremlipsum,8201337451,1,loremlipsum,7711755962,1,loremlispum,8201600368,1,Loremlipsum,7711755964,1,Loremlipsum

End Result i want

Array1: loremlipsum,221420,742151976,1,loremlipsum
Array2: ,loremlipsum,81241337453,1,loremlipsum

etc…
Later on i´d neet to insert single items from these arrays to another system.

Hi
–we can do that with datatable and datarow.ItemArray
–that is use a excel application scope and pass the file path of excel as input
–inside the scope use a READ RANGE ACTIVITY and get the output with a variable of type datatable named dt
–now use a FOR EACH activity and pass the above variable dt.Rows as input and change the type argument as System.Data.Datarow
–inside the loop use a assign activity like this
arr_variable = item.ItemArray
where arr_variable is a variable of type array of string
and item is from FOR EACH loop

now from this array variable arr_variable we can get the value using the index position which starts from 0 for first value

Cheers @Mikko_S

1 Like

Nice exactly what we needed here. ItemArray…

1 Like

Cheers @Mikko_S

Something is still wrong with this one. I get error Cannot convert from 1 dimensional etc. Did exactly as you mentioned above.

-Mikko-

can i have a screenshot of the error we are getting
@Mikko_S

Here you go.

-Mikko-

1 Like

Hi
You were almost done
Is the left side variable in assign activity is of type Array of string
And always name the variable apart from keywords as ItemArray is a keyword
So name it as arr_string which is of type array of ToString
The assign activity will be
arr_string = item.ItemArray
Also ensure that the type argument of the FOR EACH ACTIVITY is of type string

Cheers @Mikko_S

Hello @Mikko_S
You can also do it using Regex.Split method and manipulate the date to your needs

What i have done is based on this data

i Extracted and then split the data into this using regex…

Check this workflow for better understanding

Splittextcreatedatarow.xaml (12.6 KB)

1 Like

Thank you! I¨ll check this one too…

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.