MicroStrategy ONE

Position of first occurrence

The Position function returns the starting position of the first occurrence in the input string. For example, using the Position function to search for the string "Strategy" within the string "MicroStrategy" would return the value of 6.

Syntax

Position (Argument1, Argument2)

where

  • Argument1 is the substring to search for.

  • Argument2 is the string in which to search for Argument1.

Example

The Position function can be used in conjunction with other functions to perform various manipulations on strings. For an example of how this function works, consider an LU_CUSTOMER table that includes an ADDRESS column. You use the Position function to find the word Street in the addresses as defined below.

Position("Street", [ADDRESS])

For an address of 10 Main Street, the function listed above returns the value of 9. For addresses that do not include the word Street, a value of 0 would be returned.