question

SudheerReddy avatar image
0 Likes"
SudheerReddy asked CH L answered

Query on list is not working as intended.

I am trying to get the Qty label value using the Query as shown in below image. it is throwing error.

Below code is throwing error

int x=2;
Table.query("SELECT Qty FROM ItemList1.x")[1][1];

Below code is not throwing error

Table.query("SELECT Qty FROM ItemList1.2")[1][1];

ListError.fsm


FlexSim 20.1.3
flexsim 20.1.3list
1596986109085.png (45.1 KiB)
listerror.fsm (31.9 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.

Joerg Vogel avatar image Joerg Vogel commented ·

You try to parse FlexScript code into SQL clause. Try $1 or { }.

ItemList1.$1

0 Likes 0 ·
SudheerReddy avatar image SudheerReddy Joerg Vogel commented ·

@joerg.vogel

I said already in my question. Below code is working

Table.query("SELECT Qty FROM ItemList1.2")[1][1];

But when I added instead of ItemList1.2 if I keep as ItemList.$x it is not working as below

int x=2; Table.query("SELECT Qty FROM ItemList1.x")[1][1];

Yeah I tried ItemList1.$x. But it is not working

If you tried and working for you then please post that.


0 Likes 0 ·

1 Answer

CH L avatar image
0 Likes"
CH L answered

x should be in string format.

Table.query("SELECT Qty FROM ItemList1." + x)[1][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.