Add every 1000 row in one queue item

Hello All,
I have quite big table but i need every 1000 rows in one queue item … the 1000 to 2000 in new queue item.
I cant loop for each will take a very long time is there is a way around it!

Br/Hazem

Hi @Hazem_Saleh

Check out the thread

Hope it helps!!

1 Like

Hi @Hazem_Saleh

-Start by reading the entire table into a DataTable
-Write a LINQ query to partition the DataTable into chunks of 1000 rows each.

Dim dataTable As DataTable = YourDataTableVariable
Dim chunkSize As Integer = 1000
Dim chunks = dataTable.AsEnumerable() _
                      .Select(Function(row, index) New With {Key .row = row, Key .index = index}) _
                      .GroupBy(Function(x) x.index \ chunkSize) _
                      .Select(Function(group) group.Select(Function(x) x.row).CopyToDataTable()) _
                      .ToList()

-Iterate through the list of chunks and add each chunk as a separate queue item. Use the “Add Queue Item” activity within a loop to achieve this.
-Configure your workflow to process each queue item separately.

Cheers…!

1 Like

Thanks alot but issue now every row is one queue item!
im trying to get the first 1000 row (the chunk ) as one item.

hi all,

if i try bulk will split the row as one queue item

im trying to add items which has the first chunk (1000 row) but i get this error
Add Queue Item: Could not determine JSON object type for type System.Data.DataTable.
image

I found a way for it . by converting to Json

Hi @Hazem_Saleh

Converting to Json should work and you can convert back to DataTable after retrieve the queue item.

One point: the maximum specific data size limit is 1MB. If you try to add a queue item with payload more than 1MB you will get a 403 error code

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.