$position

$position

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

$position

$position

Locates the first occurrence of a pattern in a character string.

Syntax

$position(source,pattern)

Parameters

sourcea character string, or an expression that evaluates to a character string
patterna character string, or an expression that evaluates to a character string

Return Value

Number, being the position of the first character in source that matches the first character of pattern, when pattern is found in source.

Comments

$position returns a number that identifies the start position of pattern in source. If pattern is not found in source, $position returns 0.

If either source or pattern is not of a character data type, it is converted to a character string before the operation begins. If source is of data type ALPHA or VARALPHA, the operation is case-insensitive; otherwise, the operation is case-sensitive.

Example

$position(var1,”ab”)

Evaluates to 4 if var1 is “defabc”.

$position(“abcdef”,”zz”)

Evaluates to 0.

find all Customers where $position(Comments, “overdrawn”) > 0

Determines if the word overdrawn appears in the Comments field for any one of your Customers.

See Also

$concat

$delete

$insert

$left

$replace

$right

$substring

$translate

About Character Literals

About Functional Expressions

Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_CAEnglish