For Each QueueItem values via Write Line into Excel-document


I am retrieving all Queue items via a For Each and this is working great.
Now i am trying to write the queue items into Excel.

It works, but just for the first retrieved item. It keeps looping through this same item.
If i don’t stop the loop, it might continue for hours.

I use the Excel application scope, with the Read Range activity followed by for each, with For Each: Row - value output of the read range.

I combine a few ‘IF’ activities to check for values, if there is no match it will continue with ‘Insert/Delete Rows’ activity.

Am i doing something wrong with the For Each that it loops?
Is it because it is trying to loop through all the available data in Excel? it’s about 7000.

Thanks in advance!

Hi @sirwa,

Can you show us how you’re using your For Each Row in a screenshot? This’ll help work out the issue

1 Like

Hi @sirwa ,

If you are iterating 7000 rows, then it will take some time but not much.

From where you are getting the input data? from excel ?

You create one datatable and save your iterated variables into this table. Once all the iteration complete write the datatable into excel.

Giving if condition inside the For Each loops is not wrong.

Check your flow with less no of records by creating dummy data. If it is working fine then you can be sure by yourself that your workflow is correct.

1 Like

you are getting the queue items in a excel the trying to put in another excel after your conditioning?

I assume you are using the For Each Row

How are you using this? The way you are getting the data from the Queue Data Excel and pasting is the pain point, can you showcase that?

Ideally, simply use append range if you want to add directly to file OR just add data row in the Datatable at run time

1 Like

If you read the queue items you have them in a datatable. Just use Workbook Write Wrange and write that datatable to the Excel file.

If you need to remove or edit some of the data before writing to Excel, do that in your DT.

But I’m curious why you are using queue items in this way. It’s not really how queues are intended to be used. Generally you process queue items one by one, getting them with Get Transaction so that the status is updated to In Progress then either success or fail.

1 Like

Thank you all for the quick responses.

The Queue items are filled with values that have been read off a web page.
One queue contains a few different values, that are supposed to be filled inside one row, in specific columns.

I retrieve the queue items, add them with different write to cell activities to excel in specific places through variables.

The for each activity does the first contained queue perfectly. But it keeps repeating that same one, it will not move to the next queue item.

Thanks again!

It won’t move to the next queue item because you aren’t using queues properly. You need to Get Transaction to get an item to process, process it, then set its status to Success or Fail. Then loop back around and Get Transaction again, and it won’t get the first one again because it’s marked complete.

1 Like

Thanks again.

I used the Get Queue Items activity. But i understand i should be using the Get Transaction Item.
After implementing this activity, i can’t get the For Each to loop through it.

It will error me out with the following:

Get Transaction gets one transaction. There’s nothing to loop through.

You’re trying to do:

  • Get queue items
  • Loop through queue items
    – inside loop, process each item
  • end loop

What you should be doing, using a Flowchart:

  • Get Transaction (if one exists, move to processing step, if no transaction to get then go to an “end” sequence)
  • Process item
  • Set transaction status to success or fail
  • Go back to the beginning and get the next transaction


1 Like

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