Aux Database not opening before other code runs, I think

PanX 10.2.0. b10: I have a shared database (Worker) that has two aux databases, People and Company. The .Initialize procedure of Worker calls a subroutine that builds an array based on one of the Aux databases. This results in an error every time I open the Worker DB. (I used try/catch to trap the error) but the array is not built.) Once the DB is open, I can see that both Aux databases are open, and if I run .Initialize again, or just the subroutine, the array is built.

It looks like the aux database is not fully open when the code to create the array runs so the arraybuild( function fails.

To deal with this issue, after several ideas for delay that did not work, I inserted a dialog with rundialog before calling the subroutine; the user has to acknowledge the dialog by clicking Continue. The loop code checks if the Aux database is open (if info(“files”) contains the database name) before closing and continuing. This seems to work.

Panorama runs the .Initialize procedure first and then opens the auxiliary databases. It has to perform these actions in some order, and whatever order I pick is bound to be wrong for some application. So it’s not the the aux database isn’t “fully” open – it isn’t open yet at all!

I think the preferred solution would be to create the array in the .Initialize procedure of the aux database. That way you’ll be sure the database exists. Of course that won’t work if the aux database is opened without any windows.

Another solution would be to not use the aux database feature, and load these databases in your .Initialize code, as you would have done before. The aux database feature is a convenience, but you can still do it the old fashioned way.

A third solution would be to create a one time timer with the code to create the array. This is now very easy to do.