Why is my dynamic expression not working?

Why is my dynamic expression not working?

sven_f
Not applicable
305 Views
2 Replies
Message 1 of 3

Why is my dynamic expression not working?

sven_f
Not applicable

[ FlexSim 21.0.6 ]

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

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

SCHamoen
Advisor
Advisor
Accepted solution

@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?

Message 3 of 3

Jeanette_Fullmer
Community Manager
Community Manager

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