I need you help to understand in which scenario we can use skip() and Take() method togather
like below query use to split excel into chunks
ExampleExcel.zip (235.0 KB)
Split_Excel_Files.xaml (18.1 KB)
Have a look here:
This HowTo gives an introductory overview of the partition Operators: Skip, Take, SkipWhile, TakeWhile
The partition operators are used to fetch a particular subset from a set of items. The returned subset is formed by the contiguous items that are matching the provided condition.
Skip / Take Operator
The Skip Operator will omit the subsequent items from the given start for a given length and will return the remaining items
The Take Operator will return the subsequent items fr…
And have some practicals here:
let me introduce a general approach that can be also adopted to more case specific details.
DataTable with 8 Rows
Following Building Blocks are used
Calculation of the numbers of segments:
with the Ceiling method the fractions are uprounded to the next Integer
with the Skip() and Take() Method the Rows for a segment can be retrieved.
the different segments are bult by following
and do fetch the different segment rows by: …
Can anyone help me on this topic
How about the following?
Enumerable.Range(0,(dt.Rows.Count \ chunkSize)+1).Select(Function(i) dt.AsEnumerable.Skip(i*chunkSize).Take(ChunkSize).CopyToDataTable).ToArray
Sample20221108-4.zip (132.8 KB)