callingdatabase(
)

The callingdatabase( function returns the name of the database that called this procedure as a subroutine, if any.


Parameters

No parameters.


Description

If a procedure was called as a subroutine by another procedure this function will return the name of the database that contains the calling procedure.

This example shows how a procedure can check to see if the original database that called this procedure is still open.

...
... start of procedure
...
if  callingprocedure() <> ""
    if arraycontains(info("files"),callingdatabase(),cr())
        rtnerror "Calling database is no longer open."
     endif
endif
...
... rest of procedure
...

This example is a bit silly because the only way the original database could be closed is if the procedure closed it!

Here is a possibly more useful example. The procedure creates a mailing label.

if  callingprocedure() <> ""
    local  aAddress,aCity,aState,aZip,mailingLabel
    getgenericfield  callingdatabase(),"Address",aAddress
    getgenericfield  callingdatabase(),"Address",aCity
    getgenericfield  callingdatabase(),"Address",aState
    getgenericfield  callingdatabase(),"Address",aZip
    mailingLabel=aAddress+cr()+aCity+cr()+
        aCity+", "+aState+" "+aZip
else
    beep
endif

However, this example is also a bit silly because usually the calling database is still the active database (unless you’ve used a window statement). Apparently you’ll have to come up with your own non-silly example.


See Also


History

VersionStatusNotes
10.0No ChangeCarried over from Panorama 6.0