• Home
  • Setting different priorities when adding items to a queue

When you add a collection to the queue you can specify what the priority must be (default is 0). This priority is used for all the rows in the collection.

Setting different priorities when adding items to a queue

When you add a collection to the queue you can specify what the priority must be (default is 0). This priority is used for all the rows in the collection. This article will show you how to add items to a queue and give them different priorities. For example, you may want to all the rows where the department is A to have a priority of 1 and the rest a priority of 0. You can also apply this to a situation where you want to assign different tags to items as you add them to the queue. There are 3 ways you can do this.

1. Separate items at the source

You will need to ask the person who provides you the data to give you the data for department A separately from the rest. You will then use a separate Add To Queue action for each set of data and provide the appropriate priority in the action.

Separate Items

2. Filter Items

If it is not possible to separate the data before it comes into Blue Prism you will need to filter the input collection. Read the article “Filter a Collection”. to find out more about how to do this.

Filter Items

Each filter stage can store the results in a different collection and then you use a separate Add To Queue action for each collection and set the appropriate priority in the action.

3. Add items to the queue one by one

For this method you will loop through the input collection which in this example is CSV Values.

Below are all the steps that are needed in the loop.

Add Items Flow

First step in the loop is to check whether the department value of the current row is an A or not.

Add Items Decision Properties

Based on the outcome of that decision use a calculation to assign the appropriate value to the Priority data item.

You cannot just link the calculations to an Add Data to Queue action since this action adds the whole collection to the queue and not just the row the loop is busy with.

So, you need to temporarily store the data from the current row of the loop in a separate collection (e.g. Item for Queue). Set up fields in that collection to match the fields of the source data. You do not need to add an initial value.

You first need to add a new blank row to this collection by using the action Add Row found in the Collections object.

Add Items Action Properties

Then use a Multi Calc stage to transfer the data in the current row of the loop (i.e. CSV Values) to this Item for Queue collection.

Add Items Multiple Calculation Properties

You will then use an Add to Queue action. Note that the data added is the Item to Queue collection and the Priority input is referring to the Priority data item.

Add Items Action Properties

Finally, you must remove the row from the Item for Queue collection. This is to ensure that you only ever have the current row of the loop stored in this collection.

Add Items Action Properties