question

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

How to query an array?

Sometimes you need a simple list of values and you want to filter the list. In other cases you get an array of references to items, resources or tokens and you have to filter the array for an item or linked label to it. But how can you query an array.

FlexSim 18.1.1
queryarray
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

·
Joerg Vogel avatar image
1 Like"
Joerg Vogel answered Joerg Vogel commented

The complete array must be converted into a table by a query. Then I can filter the array in the same clause by the attributes I am looking for. Here is an example:

Array one = [12,13,14,15,19];
Table result = Table.query("SELECT $2 AS number FROM $1 WHERE number > 13",
/*$1*/ one.length,
/*$2*/ one[$iter(1)]);
result.cloneTo(Table("myR"));

query-an-array.jpg (98.6 KiB)
· 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.

Arimba W avatar image Arimba W commented ·

@Jörg Vogel, How do i convert the code into Flexsim 16 compatible, Sir? Thank you

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Arimba W commented ·
intarray one = makearray(7);
fillarray(one, 15,9,10,11,12,13,14);
query("SELECT $2 AS number FROM $1 WHERE number > 11",
/*$1*/arraysize(one),
/*$2*/ one[$iter(1)]);
dumpquery(reftable("result"),1);

FlexSim 16.2.2

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.