You are on page 1of 7

@ReplaceSubstring

Replaces specific words or phrases in a string with new words or phrases that you specify. Case sensitive.
Syntax
@ReplaceSubstring( sourceList ; fromList ; toList )
Parameters
sourceList

Text or text list. The string whose contents you want to modify.

fromList

Text or text list. A list containing the words or phrases that you want to replace.

toList

Text or text list. A list containing the replacement words or phrases.


Return value
newSourceList

Text or text list. The sourceList, with any values from fromList replaced by the corresponding value in toList. If
none of the values in fromList matched the values in sourceList, then sourceList is returned unaltered.
Usage
If more strings are specified in the fromList than the toList, the extra strings in fromList are replaced with the last string
in toList. Extra strings in toList are ignored. If no matches are found, @ReplaceSubstring returns the unmodified
sourceList.

If a list is specified for fromList, each subsequent list item is scanned against the resulting sourceList, with prior list
item substitutions performed.

For example:

@ReplaceSubstring("first";"first":"second";"second":"third")

returns third.

First, @ReplaceSubstring substitutes "second" for "first" from the first list item in fromList. The resulting sourceList is
now "second." The function substitutes "third" for "second" from the second list item in fromList.
Tip Use @ReplaceSubString to remove carriage returns from text by replacing them with " " or "."

Examples: @ReplaceSubstring

1. This example returns "I hate apples."

@ReplaceSubstring( "I like apples" ; "like" ; "hate" )

2. This example returns "I hate peaches."

@ReplaceSubstring( "I like apples" ; "like" : "apples" ; "hate" : "peaches")

3. This example replaces all carriage returns in the Description field's text with blank spaces.
@ReplaceSubString(Description;@Newline;" ")
@Subset
Searches a list from left to right and returns the number values you specify. If you specify a negative number, @Subset
searches the list from right to left, but the result is ordered as from the beginning of the list.
Syntax
@Subset( list ; number )
Parameters
list

Text list, number list, or time-date list. The list whose subset you want.

number

Number. The number of values from list that you want. Specifying zero (0) returns the error, "The second
argument to @Subset must not be zero."
Return value
subsetList
Text list, number list, or time-date list. The list, containing the number of values you specified.

Examples: @Subset

1. This example returns New Orleans;London.

@Subset("New Orleans":"London":"Frankfurt":"Tokyo";2)

2. This example returns London;Frankfurt;Tokyo.

@Subset("New Orleans":"London":"Frankfurt":"Tokyo";3)

3. This example returns New Orleans;London;Frankfurt if the field named BranchOffices is made up of the list
"New Orleans" : "London" : "Frankfurt" : "Tokyo" : "Singapore" : "Sydney."
@Subset(BranchOffices;3

@DbName
Returns the name of the current Domino server and database.
Syntax
@DbName
Return value
server ; path

Text list with two elements:

server is the hierarchical name of the server on which the current database resides.

This @function returns an empty string ("") if:

the database is local

the formula is used in a Scheduled agent running on the server

the formula is used in a view column

Use @Name to extract a part of the name; for example, [CN] to extract the common name.
path is the path and file name of the database.

This @function returns:

the path relative to the Notes or Domino data directory if the database is in the data directory

the absolute path if the database is outside the data directory

If the database is accessed through a directory or database link, this @function returns the location of the:

link if the @function is running locally (even if the database is on a server), so that the database appears to
be where the link is

actual database if the @function is running on a server (for example, a scheduled agent)
Usage
Be careful when using @DbName in a column formula. If you build a view, then move the database within the file
directory, thus changing its path, you must force a rebuild of the view (Cntl+Shift+F9) for the function to display the
updated database information.

Examples: @DbName

These examples assume the semicolon is the selected separator.

1. This example returns ";PERSONAL.NSF" if the current document is in the PERSONAL database stored in the
data directory of the user's own computer.

@DbName

2. This example returns "SALES1;ADMIN\STATUS.NSF" if the current document is stored in a Domino database
named STATUS.NSF in the ADMIN directory on the SALES1 server. If the database is stored at the server's
root directory (that is, it is not stored in a subdirectory), the result would be "SALES1;STATUS.NSF." You can
extract just the file name of the list by combining @DbName with @Subset, as shown in the example below.

@DbName

3. This example returns "STATUS.NSF", the file name, since this is the last element in the returned list.

@Subset(@DbName;1)

4. This example returns the path of the current database, without the file name. For example, if the current database
is SENSES\SOUNDS\SIGH.NSF, this formula returns "SENSES\SOUNDS."

@LeftBack(@Subset(@DbName;-1);"\\")
5. This example displays the server, path, and file name of the current database, substituting the common name for
the hierarchical name of the server.

database := @Subset(@DbName; -1);

server := @Name([CN]; @Subset(@DbName; 1));


@Prompt([OK]; "Database name"; @Implode(server) + " " + @Implode(database))

Table of CGI variable names

Domino captures the following CGI variables through a field or a LotusScript agent. You can also capture any CGI
variable preceded by HTTP or HTTPS. For example, cookies are sent to the server by the browser as HTTP_Cookie.
For more information about CGI environment variables, see:

http://hoohoo.ncsa.uiuc.edu/cgi/env.html
Field name Returns
Auth_Type If the server supports user authentication and the script is
protected, this is the protocol-specific authentication
method used to validate the user.
Content_Length The length of the content, as given by the client.

Content_Type For queries that have attached information, such as


HTTP POST and PUT, this is the content type of the
data.
Gateway_Interface The version of the CGI spec with which the server
complies.
HTTP_Accept The MIME types that the client accepts, as specified by
HTTP headers.
HTTP_Accept_language The languages that the client accepts, as specified by
HTTP headers.
HTTP_Referer The URL of the page the user used to get here.

HTTPS Indicates if SSL mode is enabled for the server.

HTTPS_CLIENT_CERT_COMMO The common name on the x.509 certificate


N_NAME

HTTPS_CLIENT_CERT_ISSUER_ The issuer of the x.509 certificate


COMMON_NAME

HTTPS_KEYSIZE The session key during an SSL session. For example, 40-
bit, 128-bit.
HTTP_User_Agent The browser that the client is using to send the request.

Path_Info The extra path information (from the server's root HMTL
directory), as given by the client. In other words, scripts
can be accessed by their virtual path name, followed by
extra information that is sent as PATH_INFO.
Path_Info_Decoded Returns the same as Path_Info, but decodes the string.
For example, if a URL references a view name that
contains characters that are not allowed a URL, the name
is encoded. This CGI variable decodes the string.
Path_Info_Decoded is available to Domino applications
only.
Path_Translated The server provides a translated version of PATH_INFO,
which takes the path and does any virtual-to-physical
mapping to it.
Query_String The information that follows the question mark (?) in the
URL that referenced this script.
Note If your Domino server is configured to allow
search engines to search your Web site Domino will
generate URLs with an exclamation mark (!) instead of a
question mark (?). If this is the case the Query_String
CGI variable includes the information that follows the
exclamation mark (!). Domino always recognizes both
the question mark (?) and the exclamation mark (!), but
only generates URLs with the exclamation mark (!) if
your site is accessible to Web search engines. Generating
URLs with an exclamation mark (!) makes them more
searchable.
Query_String_Decoded Returns the same as Query_String, but decodes the
string. For example, if a URL references a view name
that contains characters that are not allowed in a URL,
the name is encoded. This CGI variable decodes that
string. Path_Info_Decoded is available to Domino
applications only.
Remote_Addr The IP address of the remote host making the request.
Remote_Host The name of the host making the request.

Remote_Ident This variable will be set to the remote user name


retrieved from the server. Use this variable only for
logging.
Remote_User Authentication method that returns the authenticated user
name.
Request_Content Supported only for agents. Contains the data sent with an
HTTP POST request. The data is usually "URLencoded,"
consisting of name=value pairs concatenated by
ampersands. For example,
FirstName=John&LastName=Doe
Request_Method The method used to make the request. For HTTP, this is
"GET," "HEAD," "POST," and so on.
Script_Name A virtual path to the script being executed, used for self-
referencing URLs.
Server_Name The server's host name, DNS alias, or IP address as it
would appear in self-referencing URLs.
Server_Protocol The name and revision of the information protocol
accompanying this request.
Server_Port The port to which the request was sent.

Server_Software The name and version of the information server software


running the CGI program.
Server_URL_Gateway_Interface The version of the CGI spec with which the server
complies.

When a Web user saves a document or opens an existing document, the Domino Web server uses CGI variables to
collect information about the user, including the user's name, the browser, and the user's Internet Protocol (IP) address.

To capture this information in a Web application:

Create a field with the name of a CGI variable.


Create an agent whose script contains a CGI variable as a DocumentContext property.

@Now
Returns the current timedate.
Syntax
@Now( flags ; serverNames )

Note The flags and serverNames parameters are new with Release 6.
Parameters
flags

Keyword or keyword list. Optional.

[SERVERTIME] gets the time-date from the server containing the database if serverNames is not
specified or from serverNames ifserverNames is specified.

[LOCALTIMEONERROR] gets the time-date from the local computer if an error occurs getting it from
a specified server.

serverNames

Text or text list. Optional. A server name or a list of server names. This parameter applies when
[SERVERTIME] is specified.
Return value
now

Time-date or time-date list. The current time-date of the local computer, the server containing the current
database, or one or more specified servers. See the "Usage" section that follows.
Usage
@Now gets the time-date of the local computer in the following cases:

No parameters are specified.

[SERVERTIME] is specified, but the database is local and serverNames is not specified.

[LOCALTIMEONERROR] is specified, serverNames is specified, and an error occurs getting the time-date
from a server.

@Now gets the time-date of the server containing the current database if [SERVERTIME] is specified and
serverNames is not specified.

@Now gets the time-date or time-dates of one or more specified servers if [SERVERTIME] and serverNames are
specified.

An error occurs if @Now cannot get the time from a server specified in serverNames and [LOCALTIMEONERROR]
is not specified.

Using @Now in column or selection formulas may impact the efficiency of your application. It also causes the view
refresh indicator to display constantly.

The @Now function returns the current time with one hundredths of a second precision. However, if you use @Now to
specify the current time in a computed field, the hundredths of a second value is always rounded up to the next second,
which can result in the current time being one second fast. You can avoid this by replacing @Now with the following
formula:

timenow := @Now;
@Date(@Year(timeNow);@Month(timeNow);@Day(timeNow);@Hour(timeNow);@Minute(timeNow);@Sec(timeNo
w))

You might also like