HotDocs Author WorkflowCreate a template Add placeholders Group variables in dialogs Upload a template Create a script

POSITION Function

The POSITION function returns the position (as a number value) of one or more characters you specify within the text value you tell the function to search in. For example, if you need to look at the hour and minute of a time in a text value such as "12:30", POSITION helps you find the colon separating the hour from the minute (a position of 3). If the character sequence you type is not found, this function returns 0.

Function name POSITION
Usage model POSITION (in:TEXT, search for:TEXT)
Parameters This function requires you to provide two parameters:

in: TEXT

The parameter In: tells the function to search for text strings within the text value you provide.

search for: TEXT

The parameter Search For: enables you to specify the sub-string you want the function to locate within the text value you provide as the In: parameter.

Optional Parameter                                      last instance: TRUE_FALSE

If you type the value TRUE to use the optional parameter named Last Instance, the function searches the text backwards for the last instance of the value you provided for the Search For parameter. For example, when a user provides Mississippi as the answer to a variable called State Name, the function signature looks like this: POSITION("Fredricksburg", "ic", FALSE)

By default, this function searches for the first instance of the sub-string you provide, so typing FALSE for this parameter is redundant; this parameter is therefore optional.

Result type: Number Returns a number value corresponding to the position of the sub-string you search for. If you search for more than one character, the function returns the position of the first character in the sub-string.

Example

The following returns 3.

POSITION("12:00", ":")

If Call Time has a value of "12:30", the following returns 3.

POSITION(Call Time, ":")

The following returns 0.

POSITION("ABC", "Z")

The following returns 1.

POSITION("AA", "A")

When a user provides Mississippi as the answer to State Name, the following returns 5:

POSITION(State Name, "iss", FALSE)

See Also:
MID
INTEGER