question

Mischa Spelt avatar image
1 Like"
Mischa Spelt asked anthony.johnson edited

Query group members

Hi,

Should any of the following work? Maybe I'm just misunderstanding how $iter works, but I expected a table with the objects in my object group, or - in the last example - a table containing rows with values 1, 2, 3, ....

Table.query("SELECT $2 FROM $1", Group("MyObjectGroup"), $iter(1))
Table.query("SELECT $2 FROM $1", Group("MyObjectGroup").toFlatArray(), $iter(1))
Table.query("SELECT $2 FROM $1", Group("MyObjectGroup").length, Group("MyObjectGroup")[$iter(1)])
Table.query("SELECT $2 FROM $1", Group("MyObjectGroup").length, $iter(1))
FlexSim 18.0.2
queryobject group
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

anthony.johnson avatar image
3 Likes"
anthony.johnson answered anthony.johnson edited

The first, third and fourth examples should work fine, although the first one will work differently than you expected. The parameters you pass into the function can either be a number or a node. In the first example, Group("MyObjectGroup") simply returns the node MODEL:/Tools/Groups/MyObjectGroup, which is a list of coupling nodes. Thus, $iter(1) would subsequently return a subnode of that node, not the member of the group.

The second example will not work because the parameter is an Array type, not a number or node (perhaps we should add that ability).


queryexample.fsm (18.0 KiB)
5 |100000

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