Read every four rows and save to datatable for each device

@markosc ,

Hope the below is understandable :

  1. mc.Select(...): Within this part of the code, the Select method is used on the Matches activity output, which is a Collection. It is employed to transform each element of the mc collection into a new structure. In this context, it’s converting each Match object in mc into an array of values.
  2. Function(x) represents an individual Match object x within the mc collection.
  3. OutputDT.Rows.Add(...): Within the Select function, for each Match object x, a new row is appended to the OutputDT DataTable. This row is filled with values retrieved from the subsequent expression.
  4. Enumerable.Range(1, 4): This generates a sequence of integers starting from 1 and ending at 4 (inclusive). The sequence contains the numbers 1, 2, 3, and 4.
  5. .Select(Function(i) x.Groups(i).ToString.Trim).ToArray: For each number in the sequence (1, 2, 3, 4), it accesses the corresponding group from the Match object x, converts it to a string, and trims any leading or trailing whitespace. The outcome is an array of strings containing values extracted from matched groups.
  6. .CopyToDataTable: In conclusion, the resultant array of arrays (representing values from the matched groups within each Match object) is transformed into a fresh DataTable using the CopyToDataTable method. This DataTable is then populated with the extracted data.

Maybe also check the below on Linq :