question

Joerg Vogel avatar image
0 Likes"
Joerg Vogel asked Joerg Vogel commented

push an item to and pull it from a list, what is my mistake?

I am trying to push an item to a list and later I am pulling the item with a WHERE clause? I make something totally wrong, because I can't get it working. It is just a small example. The item gets to the list in the onEntry trigger of the queue and is pulled in the onExit trigger of the processor.

WHERE id == tonum(item)

The id contains the same item converted to a number in the onEntry Trigger.

Is there an easier approach, because the reference is already on the list? It is the value column.

FlexSim 17.2.2
listsqlpull itemwhere
· 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.

Joerg Vogel avatar image Joerg Vogel commented ·

I forgot to add a model push-pull-item.fsm

0 Likes 0 ·
push-pull-item.fsm (16.8 KiB)
Mischa Spelt avatar image
2 Likes"
Mischa Spelt answered Joerg Vogel commented

@Cameron Pluim is close: item does not exist within the scope at which the query is evaluated, but you are already passing it in as puller in the fourth argument to List.pull so no need to do string conversions.

Inside the query, you can access the item as puller and something like

WHERE id == tonum(puller)

should work (untested though).

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

Joerg Vogel avatar image Joerg Vogel commented ·

thx, it works!

0 Likes 0 ·
Cameron Pluim avatar image
1 Like"
Cameron Pluim answered Joerg Vogel commented

@Jörg Vogel

The following code should work:

"WHERE id = " + numtostring(tonum(item))

I think the issue is that "item" is unknown within the scope of list.pull so you need to change it to a number before putting it in the string. But that is just my guess.

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

Joerg Vogel avatar image Joerg Vogel commented ·

@Cameron Pluim. Thank you for your suggestion! Your approach works, too. The code must be inserted into the code editor, because in the template editor I can't end the quotation marks. The editor convert them to a character and not to a part of the code.

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.