OpenWGA 7.0 - TMLScript reference

Method :


On object WGA
Usage Returns the WGAPI database object for the given database key

Use the dbkey parameter on this method to specify which database you want to be returned.

To retrieve the database object for a content store in WebTML context you can use the method this.db() instead.

When accessing a database that has not yet been accessed in this request OpenWGA will try to login the user to this database, using whatever login information is available. If that fails - bc. the user has no access - the database is still returned but has no open session. You can test the availability of an open session by WGDatabase method "isSessionOpen()".

The method may return OpenWGA content stores as well as data sources.

The method returns null if no database of the given dbkey is connected.

For backward compatibility there still is a method "db()" with dbkey parameter available on TMLContext whose use is discouraged since OpenWGA 5.3.

Parameters dbkey (String):
Key of a database to retrieve.
Return value The database that is mapped in OpenWGA for the given key (WGAPI objekt WGDatabase)
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events
Examples The following script uses the method db() as entry point for WGAPI operations based on the database. It retrieves the available areas and returns their names:

var thedb = WGA.db("ig");
var areas = thedb.getAreas().iterator();
var result = "";
while (areas.hasNext()) {
  var area =;
  result += area.getName() + "<br>";
return result;