question

Jingyong P avatar image
0 Likes"
Jingyong P asked David Seo commented

How to get a list's content quantity?

Control List Content.fsmI want to use "Decide" to check a list's content quantity.

when list has 5 or more content, I want to redirect newly arrived tokens to sink till content qty < 5

I tried, but not working.

List("List1").stats.content.value <= 5
FlexSim 21.0.0
flexsim 21.0.0list content
· 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.

Joerg Vogel avatar image Joerg Vogel commented ·

It must be a global list.

0 Likes 0 ·
David Seo avatar image
0 Likes"
David Seo answered Jingyong P commented

@Jingyong P

You can solve your issue using (List("List1").stats.input.value - List("List1").stats.output.value) < 5 condition. And you should set List1 to global not local.

I attach the model fixed.

control-list-content_FKor.fsm

If you have a question about the model, let me know it.


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

Jingyong P avatar image Jingyong P commented ·

Thank you. Its very helpful.

0 Likes 0 ·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered David Seo commented

If you want to count the entries of a list, then you get this by

List(“List1”).entries().length

if you want to get the sum of field values, then this is a table query over a list with SUM clause.


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

Jingyong P avatar image Jingyong P commented ·

Thank you @Jörg Vogel

In my case, I only need to count the quantity of the tokens that were pushed in minus tokens were pulled out. .

Got the following error messages

Flexscript Error MODEL:/Tools/ProcessFlow/ProcessFlow/Decide>variables/decision invalid character <⾠ascii = -30

Flexscript Error MODEL:/Tools/ProcessFlow/ProcessFlow/Decide>variables/decision invalid character <> ascii = -128

Flexscript Error MODEL:/Tools/ProcessFlow/ProcessFlow/Decide>variables/decision invalid character <ܾ ascii = -100

Flexscript Error MODEL:/Tools/ProcessFlow/ProcessFlow/Decide>variables/decision invalid character <⾠ascii = -30

Flexscript Error MODEL:/Tools/ProcessFlow/ProcessFlow/Decide>variables/decision invalid character <> ascii = -128

Flexscript Error MODEL:/Tools/ProcessFlow/ProcessFlow/Decide>variables/decision invalid character <ݾ ascii = -99

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Jingyong P commented ·

None of these errors are related to a syntax error of a query. Invalid ascii character is a problem with language settings or code pages. Please ask a new question!

0 Likes 0 ·
Jingyong P avatar image Jingyong P Joerg Vogel commented ·

Those error happen only when I set condition in. That's the only change. My pc is in English and all settings are based on US. I have no idea why it shows those error.

List(“List1”).entries().length


0 Likes 0 ·
Show more comments

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.