Custom code query in pull from list activity of process flow.

Custom code query in pull from list activity of process flow.

kashif_a
Not applicable
321 Views
4 Replies
Message 1 of 5

Custom code query in pull from list activity of process flow.

kashif_a
Not applicable

I have a pull from list activity where I want to apply a custom code query in the query field. The query I want is as follows:

There are two expression fields on the list entries. First one is "flag" and the second one is "utilization". I only want to pull those entries whose utilization is less than 95. But I want to do this check for only those entries whose flag is equal to zero. For all other entries whose flag is non-zero, I don't care about its utilization, I will simply pull it no matter what the utilization.

What should I write in query field to achieve this?

Also, is there an Onpull trigger inside the pull activity that I can use to update some global table values when a pull occurs?

0 Likes
Accepted solutions (1)
322 Views
4 Replies
Replies (4)
Message 2 of 5

Matthew_Gillespie
Autodesk
Autodesk
Accepted solution

Use the query

WHERE flag OR utilization < 95
There’s no OnPull trigger, but the token will move on to the next activity as soon as it finishes the pull. So you can just put a custom code activity right after.


Matthew Gillespie
FlexSim Software Developer

Message 3 of 5

kashif_a
Not applicable

Wouldn't this query cause both entries with flag=1 and flag=0 to be evaluated instead of entries with just flag=0 because both 1 and 0 are less than 95? For example, if there is an entry in the list with flag=0 and utilization=96, it would get pulled because 0<95 and whe have an "OR" operator. But it should not be pulled.

To the second point, the reason why I need an Onpull trigger inside the pull activity itself is because there I are multiple entries being pulled by a token and I want to update some global table value corresponding to each of these pulls as they happen.

(One more trivial question here. Should it be written Puller.label or puller.label inside query?)

0 Likes
Message 4 of 5

kashif_a
Not applicable

I think this should work:
WHERE (utilization<95 and flag==0) OR flag==1

0 Likes
Message 5 of 5

Matthew_Gillespie
Autodesk
Autodesk

No, that's not how boolean expressions work. If you wanted either flag or utilization to be less then 95 you have to write that more explicitly, like this:

WHERE flag < 95 OR utilization < 95

That other query would definitely work, but it's not necessary to write it out that verbosely.

Take a look at the query I suggested again

WHERE flag OR utilization < 95

What this is saying is that if "flag" is true (0 is false and anything else is true) then the whole WHERE statement is true regardless of the utilization. On the other hand, if the "utilization" is less than 95 then the whole statement is true regardless of the value of "flag". The only time this statement if false is if "flag" is 0 and "utilization" is 95 or more.

Like I said, there's no OnPull trigger. However, the List does have an OnValuePulled event that you can listen to. Here's an example model. onvaluepulled.fsm

Puller can be either upper or lower case, but we recommend doing upper case just so it's clearer what you're doing. See the user manual page here, https://docs.flexsim.com/en/20.0/Reference/Tools/GlobalLists/FunctionalReference/#QuerySyntax



Matthew Gillespie
FlexSim Software Developer

0 Likes