25-08-23 12:54 AM
I want to add a tag to each queue item from a field in the Collection that creates the queue. In theory I can do this using the 'Tags' field in 'Add to Queue' and the formula [NLG Discontinued Stock Calculations.Product Group Manager Name].
However, BP takes the first item in the Collection and applies the value in that to all the queue item tags.
This example data set of 4,841 items contains multiple Product Groups but all queue items are tagged 'Whiteware', which just happens to be the first entry in the Collection.
Is this a bug or am I missing something? I can work around it with filters and loops but that wouldn't be as elegant.
Answered! Go to Answer.
25-08-23 04:29 AM
HI Jeremy Dam,
It is working as expected. Since you are using Add to work queue action and passing the column value to tag for all the items in the collection it wil take the first value in the collection and update it.
If you want to add unique tag based on the value for one the column, Segregate differnet collections and use multiple add queues actions to add the tags.
or
If it is more dynamic - looping the collection is the best option and add work queue action inside the work queue to update the tag based on the column
25-08-23 04:29 AM
HI Jeremy Dam,
It is working as expected. Since you are using Add to work queue action and passing the column value to tag for all the items in the collection it wil take the first value in the collection and update it.
If you want to add unique tag based on the value for one the column, Segregate differnet collections and use multiple add queues actions to add the tags.
or
If it is more dynamic - looping the collection is the best option and add work queue action inside the work queue to update the tag based on the column
25-08-23 04:35 AM
Hi Jeremy
I hope you are using the tags as a way of categorizing, and there are only limited number of Group Manager for your dataset. And as you figured out already the option that you have in this case is to get all unique Group Managers and then loop over the unique value collection and filter the main dataset for each group and adding it into the queue, another option is to loop over each record create a single row collection and add it into queue.
Passing [collectionName.Field] will always take the value of the first row if not in a loop.
Thanks
25-08-23 02:13 PM
Hello Jeremy,
Instead of adding the collection data to queue in one go, please loop the collection data one by one and add to queue.
Note: This solution may not work for large data
27-08-23 08:42 PM
Thanks Harish, and Gopal,
Makes sense. Often in BP it is not clear where a function works for the entire data set or just one row. Would be helpful if it was mentioned in the function notes but I guess we just need to experiment to find out. I'm going to create a loop to look for the distinct entries, filter the data on those one-by-one and add the Tag as a group. Would have been easier if this function loaded the queue taking the tag from each data row 🙂