I am getting a string Variable in a for each loop and want to store in a array to right in a data table using Add Row activity.
Can anyone help me please?
I am getting a string Variable in a for each loop and want to store in a array to right in a data table using Add Row activity.
Can anyone help me please?
Fine
Letâs take like we have a string variable named str_input inside the FOR EACH activity
ânow being inside that we can mention this string variable in a ARRAYROW property of ADD DATAROW activity like this {str_input.ToString}
âor if we want to add to a collection before add Datarow activity the use a ADD TO COLLECTION activity and mention the collection property as list_input where it is a variable of type System.Collections.Generic.List(of string) defined in the variable panel with default value as New List(of string) and along the item property in Add Data Row activity mention the input as str_input
âso followed by this use Add data row activity and mention the array row property as list_input.ToArray()
Hope this would help you
Cheers @sbala
@Palaniyappan ,thank you thaliva!, but getting an error as below
âValue of âStringâ cannot be converted to '1-dimensional array of objectâ
Sorry, am very new to the UI path.
Awesome
If possible can I have a view in how that string variable was mentioned
It should be like this
{str_input.ToString} Which depicts that the Datatable has only one column in it
The syntax to be used in ArrayRow is
{âvalue1â,âvalue2â,âvalue3â,âŚâvaluenâ}
Where we need to have exact number elements in this ArrayRow which is equal to exact number of columns in the datatable
Cheers @sbala
Now were we able to get them working
Kindly let know for any queries or clarification
Cheers @sbala
If I know how to create an array by adding element in for each loop, it will help to create an array which is required for datatable.
You were almost done
Itâs just a syntax issue buddy
Letâs take an example like if the datatable dt has three columns in it then if we want to pass the value to it through ArrayRow property it should be be like
{value1â,âvalue2â,âvalue3â}
Or
If we have the values in a string variable then ArrayRow should be like this
{variable1.ToString,variable2.ToString,variable3.ToString}
So here in our case if we have one column in our datatable dt_ExtractedNotes then the array row will be like
{final_string.ToSring}
Cheers @sbala
@Palaniyappan, thank you !
Yes, i was trying with {final_String}.ToString instead of {final_String.ToString} . Also I found another way of doing this as well. I will upload the XAML once I do some cleanup.
Thanks for your help!
Great
Cheers @sbala