question

Diederik Bd avatar image
0 Likes"
Diederik Bd asked Jeanette F commented

Why is my dynamic expression not working?

Hi all,

In my model, I use a dynamic expression in a global list called: "AantalReadyPlaten".

It count the number of rows with fulfill Attribute=Attribute2.

The (basic) expression is coded as follows:

string WerkStationString=value.WerkStationString;

----------------

Table result = Table.query("SELECT COUNT() FROM GlobalList WHERE Attribute=Attribute2");

if(result.numRows==0){

returnvalue = 0;

} else {

returnvalue = result[1][1];

}

//}

return returnvalue;

-----------------------

When having the dynamic button selected and pulling with the query "ORDER BY AantalReadyPlaten DESC", it gives no result. Even with the test pull queries, it gives no result. However the global list is filled with data. It gives the error: "exception: SqlQuery - Unknown error in:"

When having the dynamic button deselected the query retrieves data and pulling the row with the highest "returnvalue". So it works fine.

Anyone an idea why the dynamic expression is not working?

Thanks in advance!

Diederik

FlexSim 21.0.6
queryglobal listflexsim 21.0.6pull querydynamic expression
· 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.

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Diederik Bd, was Steven Hamoen's answer helpful? If so, please click the red "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Steven Hamoen avatar image
1 Like"
Steven Hamoen answered

@Diederik Bd It would be more usefull if you posted a very small model just showing this problem. Just a few thing I see:
1. You use GlobalList but I assume that in the real query you use the name of the GlobalList?

2. Attribute or Attribute2 are both fields in the GlobalList and also added as fields?

3. I think Count() should have an asterix or a column name, so Count(*)

Hope that one of these remarks helps you?

5 |100000

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

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.