Trigger the second time can get the right result?

I want to use the query result to the condition statement.
When I trigger the query for the first time, the result is the previous one which was wrong. I must trigger the query for the second time, so I can get the right result.

I checked the result after I trigger it for the first time, the result returned from the query is right, but in the JS code, the result was wrong.

Hi @Cheng_Eddy, go to advanced settings of the JS query and enable this:

This will make it so the values of your variables within the query update in real time. It is off by default to improve efficiency.

Thanks Paulo. I will try it.