Structure of Loops - 2.0 with Queues

Hi,

I posted a question before which you can find at this link: https://forum.uipath.com/t/structure-of-loops/301007

""The questions was this:

I need to insert data FROM an Excel onto a website. In one part I need to fill ALL the data of a particular row if the Account = 0kg. If not I ONLY need to fill in the data of 2 particular columns(Column1 and Column2) of the NEXT row and check again if Account = 0kg. Below are the steps:

  1. Type Row(1) of DataTable(From excel to Website)
  2. Check if Account = 0kg: (On website(UI Element))
  3. If YES: Click “Close” → Type Into Row(2) of DataTable(From excel to Website)
  4. If NO: Type into Row(2)(“Column 1”) AND Type into Row(2)(“Column 2”)
  5. Check if Account = 0kg:
  6. If YES: Click “Close” → Type Into Row(3) of DataTable(From excel to Website)
  7. If N0: Type into Row(3)(“Column 1”) AND Type into Row(3)(“Column 2”)

Can someone please tell me how can I do this?
Should I use a For loop, a While loop, a While Do Loop, …

I used a for loop inside a for loop but I think everything is going berserk!

How do I update the Row number? For ex: Row(1), Row(2), Row(3)…
How can we update a row with a counter?""

And @ [NIVED_NAMBIAR] helped me with the structure in this xaml file: Main.xaml (14.0 KB)

I tried it and it worked. But now I wanted to know if we could do it using Queues?
What can we change in the xaml file to make it work with queues?
For example: when working with Excel, it is easy to find Row(3)(“Column 1”) and Row(3)(“Column 2”). But how to do it with Queues?

Thanks for help!

Note: I already sent my data to Orchestrator!

@NIVED_NAMBIAR Can you help please?

As you’ve already sent data to orchestrator, now instead of reading data from excel, use get transaction item activity and store data in queue item type variable(say TSitem). If you can see your data in queue item specific content, then you can use assign activity and store the value TSitem.SpecificContent(“ItemNameAsInYourQueueItem”) to the variable data1, similar actions for data2. Now keep the remaning part of your workflow as it is.

Hope you understood. If you can share screenshot of your queue item, I can give more clear code.

1 Like

Hi @Surya_Narayana_Korivipadu ,

Thanks for the advice!
What about places where I had <DataTable.Rows(count)(“Column1”).ToString> ?

How do I convert these into queues?
Also, I have a variable Count which gets updated in the while loop. Will it still work in the queues?

Thanks!

You should use TSitem.SpecificContent(“ItemNameAsInYourQueueItem”).ToString only in the places where you have DataTable.Rows(count)(“Column1”).ToString and DataTable.Rows(count)(“Column2”).ToString. You don’t need to use count variable any more. Also instead of the conditon <count<dt1.Rows.Count> use . It’s also a good idea to update your transaction item status to successful or failed, using set transaction status activity, after your job is done.

Go through the courses “Variables, Data Types and Control Flow”, “Data Manipulation” and “RPA developer advanced learning plan” in UiPath academy, if you want to understand how to work with variables, data tables and queues.

Well, it is not going to be the same thing if I don’t use count.

There are places where I need to put the data of the Next Row of column 1 and 2 only and places where I need to put data of the enitre Row.

If I cannot use count, I cannot specify the SpecificContent each time manually.

The Set transaction thing is okay. But I need to use a Business Exception as the next row depends on the previous row, so if there is any problem, the robot should stop.

Then you should upload all the row data to transaction item. Now instead of storing specific content in data 1 and data 2 variables, store all the specific content one by one into an array or list(say currentArray). As soon as your job is done with this transaction , then store this currentArray into another array variable(say PreviousArray). For this first time, your PreviousArray can contain empty values. Now you have two arrays representing previousRow and currentRow. You can make use of these arrays to build your workflow. Please note that all your transaction items should be processed by single robot and if you like to set priority, then set same priority for every transaction item.

does it help?

Hi @Yudhisteer_Chintaram1
sorry for delayed response

i had made a sample workflow for the queue system

let me know if it works for you
Queue_System.xaml (24.5 KB)

Regards,
Nived N
Happy Automation

1 Like

Thanks @NIVED_NAMBIAR ,

I am a few questions,

  1. Does this process below represent this: Row(2)(“Column 1”) AND Type into Row(2)(“Column 2”)

In the earlier file, the process was as such:
image

I am asking because we don’t use “count” in the expression “transaction_item.SpecificContent(“Column 1”).ToString”.

Or, when we go back to activity “Get Transaction” it automatically fetch the next row?

Thanks!

yes both represent same thing as u said

1 Like

I am testing it. I think it should work fine.

One more help @NIVED_NAMBIAR ,

in the structure before we used a “WHILE” loop, and now we are using a Flowchart(for the Queues).
Can we change the structure before into a Flowchart type as well?

Thanks!

Hi @Yudhisteer_Chintaram1
yes it seems, need to tryout that

Can you help me please?

Let me try that @Yudhisteer_Chintaram1

1 Like

Hi @NIVED_NAMBIAR
Any luck?

Hi @Yudhisteer_Chintaram1

Just have a look at this workflow for datatable
Queue_System.xaml (23.2 KB)

Regards,
Nived N
Happy Automation

1 Like

Hi @NIVED_NAMBIAR ,

Thank a lot again!!!

I had one question though:
I have a Type Into activity with the following expression:

dt1(count)(“column1”).ToString

And in your structure you assigned data_1 to:

dt1.Rows(count)(“column1”).ToString

I wanted to know what is the difference between these two expressions?Can they be used interchangeably?>

Thanks!

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