Dealing with an issue trying to take a datatable that could be anywhere between 10 rows to 3,000 rows. The first column will be an alert number, second column are ID numbers. An alert can have more than one ID linked to it.
I need a way to take all of the rows from one alert number and combine them so I have a list of all the IDs into a comma separated list of IDs in one cell so I can pull that out as a variable and dump it into a SQL query.
welcome to the forum
prepare the target datatable with the build datatable activity and configure an empty datatable with the two columns - dtResult
Or
Assign Activity:
dtResult = YourDataTableVar.Clone
Assign Activity
dtResult =
(From d in YourDataTableVar.AsEnumerable
Group d by k=d("alert").toString.Trim into grp=Group
Let js = String.Join(",", grp.Select(Function (x) x("ID").toString.Trim))
Let ra = new Object(){k,js}
Select r = dtTarget.Rows.Add(ra)).CopyToDataTable
For further info also have a look here:
seems that there is a missing ‘)’ from the code here. I tried to add it at the end here “Add.(ra))).CopyToDataTable” but uipath doesn’t like it. I get a compiler error.
can you check with updated statement a ) was missing after the Trim )
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.