I want to club the data with respect to rows, i.e. i want 100 rows in a data in 1 row, like if my input contains 800 rows then my out dt will contain 8 rows. I am attaching an excel with input in my Input Sheet and output in result Sheet.
I am also attaching my workflow here, i have done this entire thing with the help of for each and if condition and it is running perfectly file but i want it to be done with the help of LINQ. Please help team. Main.xaml (23.3 KB)
(From i in Enumerable.Range(0, Segments)
Let si = dtData.AsEnumerable.Skip(SegmentSize*i)("Starting Index").toString.Trim
Let ei = dtData.AsEnumerable.Skip(SegmentSize*i).Take(SegmentSize)("Ending Index").toString.Trim
Let ra = new Object(){si,ei}
Select r = dtResult.Rows.Add(ra)).CopyToDataTable
@Yoichi , actually my one was increasing with the number of times the loop was running and that was wrong. The solution that you gave works perfectly fine. Thanks a lot.
Can you explain the logic behind this query? I am actually confused about how you managed for that last 45 entries.
LINQ Take method returns specific number of item. if There are less items in the collection it returns all the remaining without error. So it’s unnecessary to take care last chunk carefully.