How to query an array?

How to query an array?

joerg_vogel_HsH
Mentor Mentor
133 Views
3 Replies
Message 1 of 4

How to query an array?

joerg_vogel_HsH
Mentor
Mentor

[ FlexSim 18.1.1 ]

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.

0 Likes
Accepted solutions (1)
134 Views
3 Replies
Replies (3)
Message 2 of 4

joerg_vogel_HsH
Mentor
Mentor
Accepted solution

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:

12514-query-an-array.jpg

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"));
Message 3 of 4

arimba_w
Not applicable

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

0 Likes
Message 4 of 4

joerg_vogel_HsH
Mentor
Mentor
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