question

Marco Baccalaro avatar image
1 Like"
Marco Baccalaro asked Matthew Gillespie answered

itemtype on Pull Query

In 2017 Update 1 I'm not able to pull from a list basing on itemtype:

  • WHERE type = getitemtype(puller) doesn't work cause getitemtype is deprecated
  • WHERE type = puller.attrs.itemtype.value doesn't work either and gives a compiler error

What's the right way to do it?

FlexSim 17.1.0
itemtype query
· 4
5 |100000

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

Michael Machado avatar image Michael Machado commented ·

Did you try 'item.type(puller)' for the first option and 'puller.attrs.item.type' for the second option?

0 Likes 0 ·
Marco Baccalaro avatar image Marco Baccalaro Michael Machado commented ·

I tried them now, they don't work.

  • item.type(puller) seem strange to me cause there is no item to start from in the query, just the puller.
  • and puller.attrs.item.type I think requires an attribute named "item" that doesn't exist.

Seems that the itemtype is getting deprecated in FlexSim and labels have to be used instead of it. But I have old models that don't work anymore in the new version without changing every itemtype to a label.

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Marco Baccalaro commented ·

itemtype was deprecated, but old models should continue to work fine using the old itemtype stuff. Only new models or new objects added to old models should be affected by the change. This looks like a bug to me.

0 Likes 0 ·
Marco Baccalaro avatar image Marco Baccalaro commented ·

I forgot: WHERE type = puller.as(Object).attrs.itemtype.value doesn't work too.

0 Likes 0 ·
Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered

This is a bug. Your model was built before 17.1 and so your items correctly have a value on their itemtype node that is correctly returned if you open a script console and execute getitemtype(so). The SQL parser is not recognizing the getitemtype command correctly, though and so your query isn't working. We'll look into that.

As Cameron mentioned, new models no longer use itemtype and instead use a Type label. To get the same query working you would have to do:

WHERE type = puller.Type

You should still be able to use all the same pickoptions and list fields since we've updated all the code behind those to reference the Type label.

For future models and training though, you'll have to avoid using the itemtype commands and reference Type labels or just use the pickoptions that already do that.

5 |100000

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

Cameron Pluim avatar image
0 Likes"
Cameron Pluim answered Matthew Gillespie edited

Have you tried:

WHERE type = puller.Type

The change log for 17.1.0 has the following line:

Changed itemtype references to referencing an item's Type label instead.

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

Marco Baccalaro avatar image Marco Baccalaro commented ·

Thanks, that's what I've intended. I'll have to change a lot of exercises in my training courses cause itemtype was wildly used.

1 Like 1 ·