Adding priorities in queue

I have sorted a datatable upon various condition and my final dt looks like below :

input is Brand value
MASTER 20
MASTER 21
MASTER 22
KIDS 23
KIDS 24
KIDS 25
EDUCATION 50
EDUCATION 55

expected output :

Brand value Priority
MASTER 20 HIGH
MASTER 21 LOW
MASTER 22 LOW
KIDS 23 HIGH
KIDS 24 LOW
KIDS 25 LOW
EDUCATION 50 HIGH
EDUCATION 55 LOW
.

I need to add these in orchestrator queue .priority should be high for 1st item of each brand . kindly help me to .

Hi @tharani.natarajan

Can you try the following?

Code:

(From row In dtInput.AsEnumerable()
            Group row By Brand = row.Field(Of String)("Brand") Into Group
            Let sortedGroup = Group.OrderBy(Function(x) x.Field(Of Double)("Value"))
            From item In sortedGroup.Select(Function(x, index) New With {
                .Brand = x.Field(Of String)("Brand"),
                .Value = Convert.ToInt32(x.Field(Of Double)("Value")), ' Convert to Int32
                .Priority = If(index = 0, "HIGH", "LOW")
            })
            Select dtOutput.Rows.Add(item.Brand, item.Value, item.Priority)).CopyToDataTable()

Input:
image

Output:
image

Sequence9.xaml (10.4 KB)

Cheers!!

Hi @tharani.natarajan

Input:
image
Workflow:


Add Queue Items:

When transactions get added to Queue:

xaml:
Sequence6.xaml (12.7 KB)

Hope it helps!!
Regards

@tharani.natarajan to build the data table in the required format you can follow the approach suggested by @lrtetala and to add the priority, either you can use a switch case where two cases you can add high and low, and based on the Priority column of each row you can add the queue item or you can use the API call to add bulk upload you can take a reference from official documentation Orchestrator - Transactions Requests

@tharani.natarajan

Prepare datatable exactly as you shown above then use add bulk queue items

Cheers

Thanks when i try to calll the sequence i get below error .can you help to fix this