Best way to time multiple queries?

Hey all, on one of my scenes, I have to execute 3 queries on some large data

  1. Copy SourceNames from a source table to an ActiveNames table 

  2. Update ActiveNames table with some data

  3. Query and iterate through the ActiveNames table and show all the names

Now, I have no problems with the SQL or iterating through the names, but when I try to execute the 3 queries in order, using db:exec, the third query doesn’t show any data.

I assume I need to give time for the first two queries to finish…
 

Should I use a timer and delay or is there a way to check if the prior query has finished before executing the next one?

Any advice? 

Thanks!

The third query doesn’t show any data but if you manually examine the contents of your data in your sandbox do you see the updated ActiveNames content?

I’m using Storyboard, so, if I execute the queries in the function “scene:enterScene( event )” then everything works.  If I execute them in the function “scene:createScene( event )” then no dice.  I assume, then, that this is the right place to do this… ?

It must be something to do with scope. ie what else are you doing in each of those two scene events/functions etc. If it works in enterScene then keep it there but recognize that it will trigger each time you go in and out of this scene. If that is the preferred action then great!

The third query doesn’t show any data but if you manually examine the contents of your data in your sandbox do you see the updated ActiveNames content?

I’m using Storyboard, so, if I execute the queries in the function “scene:enterScene( event )” then everything works.  If I execute them in the function “scene:createScene( event )” then no dice.  I assume, then, that this is the right place to do this… ?

It must be something to do with scope. ie what else are you doing in each of those two scene events/functions etc. If it works in enterScene then keep it there but recognize that it will trigger each time you go in and out of this scene. If that is the preferred action then great!