Get Queue Items condition not working and iterating again

I want to compare Queue items in the Orchestrator Queue with data in the website by using Get Qeue Items.
So we will compare application in the website with the Queue if this application number is not present in the queue then Add to the Queue.

And if present in the Queue then we will check the status of the Queue item if status is equal to “Failed” then add to the Queue otherwise don’t add.
I am attaching my activity.
Test Get Queue.zip (13.0 KB)
Capture
The result is like this. In this case application number 51 is not present in the Queue but it is repeating and adding 2 times to the queue.
Also applications with number 46 and 43 is present in the Queue but it is also repeating and adding to the Queue. (i don’t want queue to be unique that’s why i don’t want to repeat)

Hey @zeshanm9

For the first query: number 51 might be twice in the application, so it’s adding two times to the queue. Conform with that once
Second query: Once again check the status in Orchestrator, if status is not failed then try to change the condition in IF,
item.Status.ToString = “Failed” and SplitReqNum.Trim.Equals(item.Reference)
like the above,

Thanks,
Goutham Vijay

Hi @GouthamVijay
No it is only 1 application with the same ne as 51 in the website.
The problem is when it gets items from Queue so it is comparing each value with the website. For example in the loop comparing Queue item 51 with 46,43 and 51 so it will add 46 and 43 to the Queue because they are not equal to 51.
Same like other application numbers. So i need a solution to compare application number with all queue items so if not found in the queue then only add that application, not all.

Do i need another loop or if condition to check this condition if uipath compares 51 with 43 and 46 then do not add 43 and 46 to Queue. Just check the specific application and if find don’t add and if not find then add.

@zeshanm9

Could you add Output Datatable and check the output, verify whether the 51 is having a duplicate or not.

yes i did that, i add output datatable and 51 is only 1 time.
Can you please check the conditions in my uipath workflow and also the for each and for each row loop.
I believe i need to do something in the conditions.

@zeshanm9

I got that, the reason might be 51 could have added twice into the same queue, so while performing looping it’s adding twice.
If you run the PERFORMER program(data adding to the queue) twice, duplicates will be added to the queue.

@zeshanm9

Your current logic works like this,
For loop: object from Data Scraping
For loop: queue item
//if condition: checks the first object with all the queue items
end if
end for
end for

Instead you can try the below Algorithm to escape from the duplications
For loop: object from Data Scraping
For loop: queue item
//if condition: checks the first object with all the queue items
Add Data Row if the object is not in queue
end if
end for
end for
Remove duplicates inside the Datatable
Add datatable into Queue by looping

Hi @GouthamVijay can you please do this for me in my workflow because i try but i am not getting the expected results .

@GouthamVijay i am waiting for your response

Hey @zeshanm9

Please go through in modified workflow, in Add Queue Item i have added all the items to ColumnName column, as i don’t know the name you used in queues.
Queue.xaml (26.9 KB)

Thanks,
Goutham Vijay

Hi @GouthamVijay
Thank you for the effort. Now it’s working but i have 1 problem that it is adding to the Queue again and again the same 3 applications which is currently in the website .
Do you have any idea how to manage this also ?

@zeshanm9

What element it is adding and what are those 3 applications?

it is adding application number 51 , 46 and 43 to the queue when i run for the first time (this is working)
but when i run for the second time it is adding again the same application number 51,46 and 43 to the queue. so it is coming in the queue as :

43 - status = new
46 - status = new
51 - status = new
43 - status = new
46 - status = new
51 - status = new

@zeshanm9

Logically it should not add, create one new queue in orchestrator and add the elements to the queue only once(separate program), after that create one more program for comparing with website values.

i believe logically it should add because the queue is not unique and we are just removing the duplicates from our datatable not from the queue. So when the process runs it will add the rows to the data table and will remove the duplicates and add to the queue.
Now we need to add a condition or something to not add to the queue again

@zeshanm9

It should not add any duplicates to the queue if you follow the modified logic because:

  • At first you add the list of data to the queue (ie One time Job)
  • Then you get the data from the queue compare it with website values, if not exists add or if exists don’t do anything

Note: Remove the status check from the logic, that might help you with duplicates. If you want to further verify with Failes status you can do that in first program

yes i remove the status condition. and i also debug.
the conditions is looking fine but still adding to the queue.


i change only this after you send the workflow. is it ok ?

@GouthamVijay can you please have a look again to my workflow if conditions because i believe something is missing in the condition.

@zeshanm9

Queue_One.xaml (27.0 KB)

Run the above workflow by creating new queue and running performer program once.