The setactivedatabase statement makes a database active (without changing the configuration of the windows).


This statement has one parameter:

database – is the exact name of the database that is to be made active. This must be a database that is currently open. If the database name is "", the database associated with the currently active window will be made active.


This statement will make a database active, but does not change the currently active window. This allows you to perform operations on a database that is currently in the background as far as the current window arrangement is concerned.

This example updates an inventory database. It temporarily switches to the Inventory database to do the update, then switches back to the original database when it is done.

setactivedatabase "Inventory" // use secret window
if error
    message "Sorry, cannot update inventory."
find Description=fieldvalue("Invoice",Description)
if info("found")
setactivedatabase ""

Note: The final setactivedatabase statement is not really necessary, since Panorama will automatically switch back to the database associated with the currently active window when a procedure stops running.

Note: The statement:

setactivedatabase someDatabase

Is equivalent to this older code using the window statement.

window someDatabase+":SECRET"

There is absolutely no difference in operation between these two versions, but we think the new statement (setactivedatabase) is clearer and easier to understand. A database activated this way remains the active database until the procedure ends, until another setactivedatabase statement activates another database or until the visible window changes, such as when a message or alert is triggered. The use of the save statement has the same effect.

See Also


10.0NewNew in this version, but performs basically the same function as a window "database:secret" statement.