2

I got an answer on one of my questions here on SO regarding where to place some code after the form initialization.

Event Method Sequences when a Form is Opened

As far as I see, init and run are executing on thread 1 while executeQuery goes on thread 2. So, in order to iterate over the form_ds, I should pick a method which executes on thread 2, just to be sure that executeQuery has finished.

Is that correct? Where exactly is the best place to add some code like datasource iteration?

Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
Olaru Mircea
  • 2,570
  • 26
  • 49
  • 1
    Depends on how often you want this code to be executed. Does it only have to be executed once at start of the form? Does it need to rerun every time the data is refetched? Does it need to run when a single record in the datasource is modified? Does it need to run on creation or deletion of a record (before it's stored to the databse or after)? Usually answering these questions will provide you with the correct place to call the code from. – Reinard Dec 20 '15 at 12:10

1 Answers1

1

There is not a single answer to the question as it depends on the situation.

If you require that executeQuery is executed, consider to place the logic there after super() controlled by a global boolean.

Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50