cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple instances of Excel opened after loading the queue

BenAnderson
Level 5
Hi,  I have a process that adds 19 items to a queue to be worked. After adding the items to the queue, the process "Gets Next Item" from the queue and the data for that item is put into a collection. This collection has one row with all of the relevant bits of data for that particular queue item in different columns.  The next stage of the process is to open an excel workbook. However, when it goes to open the workbook, it opens 19 instances of the same workbook, one straight after the other.  This is presumably linked to the number of items in the queue in some way. Though, surely it should only open one workbook for that particular queue item (the file path to the workbook is in the collection containing the one row of queue data above). What could the reason be for this error? Any help would be greatly appreciated.   Thank you,  Kind regards,    Ben
Benjamin Anderson, Senior Consultant, UK
12 REPLIES 12

david.l.morris
Level 15
Hi Ben, It just occurred to me. One thing you may want to check into is to verify that the data you add to the queue gets cleared out within the process after adding it to the queue. I have encountered similar issues before when it turned out that I was doing this: 1. Get rows of data from Excel into a Collection 2. Add those rows as individual items in a queue 3. Get Next Item from the queue 3. Start working the Collection The problem in my example is that even though I added data to the queue and I retrieve the data from the queue, I accidentally referenced the original collection because it is still held in memory. This could cause your process to have access to all 19 rows still. I would go in and add a stage (if it's not doing this already) that clears the collection just after adding to the queue. This will ensure that the data your loop works with is only coming from a single queue item. Respectfully, Dave

Dave Morris, 3Ci at Southern Company

BenAnderson
Level 5
Hi Dave,    That sounds very sensible. Thank you for the suggestion. I'll give that solution a try today and see how it goes! Many thanks again for your time,   Kind regards,  Ben
Benjamin Anderson, Senior Consultant, UK

BenAnderson
Level 5
Hi Dave,    I managed to get the process to work and only open one instance of excel. It turns out that whenever it opened the excel report, it used the workbook name/file path from the one row in the data collection. However the very next action in the process was an ""Apply Filter"" action. This second action used a workbook name from a single data item created earlier in the process, (even though it was the exact same name). Once I changed this data item to the workbook name from the queue collection it worked fine.  Based on your solution above, I went through the whole process and did find a couple of further instances where it should have been using this queue collection for the workbook name, but instead was using this one data item.   Thought it best to put this solution up here, in case anybody else has the same problem.  Thanks again for your help,   Kind regards,  Ben    
Benjamin Anderson, Senior Consultant, UK