OpenWGA 7.0 - TMLScript reference

WGA
Method :

database()
database(dbkey)
database(context)
database(WGAPI-WGDatabase)

On object WGA
Usage Retrieves either an App or a DataSource object, depending on the type of database addressed
Description

OpenWGA knows two types of databases: web applications and data sources (see Basic artefacts and terms). This method can be used to retrieve both, independent of their type.

There are four variants of this method:

  • WGA.database() retrieves the App/DataSource of the current scripts context
  • WGA.database(dbkey) retrieves the App/DataSource of the given database key
  • WGA.database(context) retrieves the App/DataSource of the given WebTML context
  • WGA.database(WGAPI-Database) retrieves the App/DataSource that is represented by the given WGAPI database object

If the context/dbkey/WGAPI database represents an OpenWGA web application then an App object is returned. Otherwise a DataSource object is returned. In each case it is an object providing the functionality of the Database base object.

If the currently logged in user has no access to this database then a Database object is returned without an open session (testable via method isOpen()).

Parameters

dbkey (String):

Database key

context (TMLContext):

WebTML context

WGAPI-Database (WGAPI-Object WGDatabase):

WGAPI database object

Return value A subtype of the Database object
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events