question

Skovdestudents avatar image
1 Like"
Skovdestudents asked Skovdestudents commented

return objects outport

Hello, we are 2 students trying to make a generalisable processflow that can be applied to several models unitflows, we are using tables as information to find objects and we are trying to make a "Wait for Event" inside the processflow and this wait for event should be listening for an object that is found through a table and then the last outport that was used

Our code:

...
int PortUsed = token.itemCurrentOP;


Variant tableID = /**\nTable: *//***tag:TableName*//**/ "StagesBuffer"/**/;
Variant row = /**\nRow: *//***tag:row*//**/ token.Stage/**/;
Variant col = /**\nColumn: *//***tag:col*//**/ token.Article/**/;


Table table;
switch (tableID.type) {
  
 case VAR_TYPE_NODE: table = tableID; break;
 case VAR_TYPE_STRING: table = Table(tableID.as(string)); break;
 default:
 table = reftable(tableID.as(int));
 break;
}
Object queue = model().find(table[row][col]);
Object connectedObject = queue.outObjects[PortUsed];


return connectedObject;


We do not get this to work and if we replace last row with return

 model().find(connectedObject); 

we get error


read earlier post on similar problem but that solution does not work for us

FlexSim 23.0.4
outport
· 2
5 |100000

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

Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·

Have you tried stepping through the code with a breakpoint added and looking at your local variables? Or use a print command to print the connectedObject value to the output console?

1 Like 1 ·
Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Skovdestudents, was Joerg Vogel's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Skovdestudents commented

I set up to listen for an entry event of queue. Then I edited the source of the event to evaluate a source code.

The global table cell datatype is set to pointer data and [Edit] with a second cell of string datatype.

wait-for-event-object-by-table.jpg

wait_for_event_object_by_table.fsm


· 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.

Skovdestudents avatar image Skovdestudents commented ·
We dont have a problem finding the object from table, only when trying to find the object connected trough a port. But we have moved on with another solution so it works for us now..


Thanks

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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