SBM AppScript Reference → Programming SBM AppScript → Application Objects → Object Types → AppDb
This object represents the current connection to the database. There is only one such object defined at a time. Scripts can use AppDb objects provided in the Shell but cannot create new AppDb objects.
AppDb does not inherit from any object type.
ColName (colname): Converts the parameter to the form of a valid database column name, using the same transformation applied when you enter logical field names in SBM Composer. There is no database lookup of actual field or column names; it is a simple text transformation. For example, given "submit date?", this function returns "TS_SUBMIT_DATE". "TS_" is prepended, alphanumeric characters are converted to uppercase, spaces are converted to underscores, and other characters are omitted.
This function provides a measure of safety when working with column names, because the output is guaranteed to be of a legal form. However, because logical names can be changed at any time after a column's creation, passing a field's logical name to this function will not necessarily yield its actual database name. This function can assist an SBM AppScript programmer who recalls a column's "basic" database name but not the exact formatting rules for punctuation and spaces. An alternative to calling this function is to be sure of the exact column name by looking at the field's database name in SBM Composer or opening the database itself to see the desired column.
Input: colname (String) – Base name of field or column (without "TS_"). Can contain spaces, punctuation, and mixed case.
Return: String – A column name in legal database form, containing only upper case letters and underscores.
GetConnectionInfo(dsn, dbname, srvname, remote): This method provides information on the data source name, the name of the database, the name or IP address of the server that contains the database currently connected to SBM, and whether the connection is remote. If you are connecting to a Microsoft Access database, the server name is not returned.
Output: dsn (String) – The data source name from ODBC the connection is using to access the database.
Output: dbname (String) – The full database name that the connection is accessing.
Output: srvname (String) – The server name the connection is using to access SBM. This could be a machine name or an IP address.
Output: remote (Boolean) – True if the connection is a remote administrator; false if not. Since scripts cannot be executed from a remote connection, this is always false.
Return: Boolean. True if the method was successful; false if not.
ReadFolderItems(list, folderId): This method provides a list of items in a folder. Create a FolderItemList and pass in the TS_ID from the TS_Folders table of the folder you would like. Keep in mind that a folder ID is needed to retrieve this list and the folder table contains an inbox for every user so it may be a bit of processing to find the correct TS_ID from the TS_Folders table before this method can be used effectively.
Input: folderId (Integer) – The parent folder of the items you wish to access.
Output: list (FolderItemList) – The list of items in the folder.
Return: Boolean. True if the method is successful. False if not.
UserId: (long integer) – The TS_ID of the current user.
Copyright © 2007–2015 Serena Software, Inc. All rights reserved.