question

Axel Kohonen avatar image
0 Likes"
Axel Kohonen asked Axel Kohonen commented

Exception when querying a tree structure and nothing is found

Hi,

If I query the task sequences of the dispatcher using a custom query that iterates through the task sequences I get an exception if the query does not find anything that matches.

Is this a bug? It seems that it should just return an empty table as the result if nothing is found. If it is a bug, then how do i get around it?

See the attached model where everything works fine until there is nothing that has priority 2 in the task queue. I have an error check for nothing in the queue, but that does not work if there is something in the queue, but not anything with a priority of 2. And the query itself checks if there is so I should not need an error check here in my opinion. I would not use a query if I knew exactly what there is in the queue.

My original idea to use queries is that it would be a more flexible and understandable way to choose the correct task for an operator that becomes available. If there is some smarter way to do this than querying the task queue, then please let me know.

Thank you!

Kind regards,

Axel

FlexSim 18.2.2
bugquerytask sequencetask sequence queue
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

martin.j avatar image
1 Like"
martin.j answered Axel Kohonen commented

Im not sure I understand or can repilcate your problem. The exception I get does not come from your query itself, but from your attempt to clone an empty result table to a global table. If you put a check before you clone to global table you should be good.

 //dump result into table
 if (result.numRows)
 	result.cloneTo("GlobalTable1"); 


flexsimscr.jpg (269.7 KiB)
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Axel Kohonen avatar image Axel Kohonen commented ·

Hi @martin.jensen

Thank you for your answer. You are obviously right. I just thought that also en empty table could be cloned, but I guess the memory only table points to nothing if is it empty.

Kind regards,

Axel

0 Likes 0 ·