Accessing data outside the current document and database

The following @functions get data values from a specified database. You cannot set values with these @functions.

  • @DbLookup looks up a specified value in the first sorted column of a specified view in a specified database. For each document that matches the search value, @DbLookup returns the value of a specified field on the document or column in the view.
  • @DbColumn returns all the values in a specified column in a specified view in a specified database.

The first three parameters are the same for both functions:

  • "Notes®" : "NoCache" specifies that the operation is on a Domino® database and is not cached. You can specify "" for the first list element because "Notes®" is the default. If the data is stable and/or you are accessing the database many times, you can specify the second list element as "" to not use a cache. You can specify the entire parameter as "" to mean a Notes® database and a cache. If you specify a cache, you can specify "ReCache" on subsequent lookups to the same data source to refresh the cache.
  • server : database specifies the server and database you are accessing. Specify the first list element as "" to mean the local Domino® directory. Specify the entire parameter as "" to mean the current database. You can specify the entire parameter as the replica ID of a database. Notes® will search locally and on servers, and use the first replica it finds. Get the replica ID by choosing File - Database - Design Synopsis, Replication.
  • view specifies the view through which to access the database.

For @DbLookup, the fourth parameter is the key, the value to search for in the first sorted column in the view. @DbLookup finds every document that matches the key value. Specify [PartialMatch] in the sixth parameter to match the key against the beginning characters of the column value rather than the entire column value.

For @DbLookup, the fifth parameter is either the name of a field in the database or the number of a column in the view. @DbLookup returns a list of the values in the fields or columns of the found documents. Specify [ReturnDocumentUniqueID] in the sixth parameter to return instead the UNID of the document.

For @DbColumn, the fourth parameter is the number of a column. @DbColumn returns a list of all values in the column.

The following @functions get and set field values in another document in the current database. However, you must know the unique ID of the document.

  • @GetDocField(unid; fieldName) gets the value of a field given its unique ID.
  • @SetDocField(unid; fieldName; value) sets the value of a field given its unique ID.

These functions are suited to accessing and setting values in the parent of a response document, since the unique ID of the parent is in the $Ref field of the child. In documents that have "Formulas inherit values from selected document" set, you can use @InheritedDocumentUniqueID as the formula in a hidden field in the base document, then use that field name as the formula in a hidden field in the inherited document. Otherwise, you must devise a scheme for storing and retrieving the unique IDs of the documents that you want to access.

The following @functions get and set field values in one or more profile documents in the current database. Profile documents are hidden documents used to store information that can then be shared across the database. You can create one profile document per user or one profile document for the entire database.

@GetProfileField retrieves a field from a profile document and caches the field's value for the remainder of the session.

@SetProfileField sets the value of a field in a profile document.