Enterprise Server Databases Variable Scope and Interoperation

Using a web browser submitting an url to Panorama Enterprise, how can I begin a procedure in one web shared database, set a different database as the active database on the server, like window or setactivedatabase “DATABASE”, do some stuff with some variables from the initiating database, return to the initiating database and then send the cgiHTML response back to the browser.

My challenge is understanding variable scope, openserverfile etc.

Thanks