Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
lavanya14
Contributor III
Contributor III

position of a value in field

Hi all,

Is there any function to find the position of a specific value in a field.. Lets say i have a field customer name. I have ABC customer in it.. I want to know the occurance of the value 'ABC' of it in the field.

Thanks

1 Solution

Accepted Solutions
maxgro
MVP
MVP

from online help

index(s1 , s2[ , n])

Position of a substring. This function gives the starting position of the n:th occurrence of substring s2 in string s1. If n is omitted, the first occurrence is assumed. If n is negative, the search is made starting from the end of string s1. The result is an integer. The positions in the string are numbered from 1 and up.

Examples:

index( 'abcdefg', 'cd' ) returns 3

index( 'abcdabcd', 'b', 2 ) returns 6

index( 'abcdabcd', 'b', -2 ) returns 2

left( Date, index( Date,'-') -1 ) where Date = 1997-07-14 returns 1997

mid( Date, index( Date, '-', 2 ) -2, 2 ) where Date = 1997-07-14 returns 07

View solution in original post

4 Replies
Anonymous
Not applicable

Index()

maxgro
MVP
MVP

from online help

index(s1 , s2[ , n])

Position of a substring. This function gives the starting position of the n:th occurrence of substring s2 in string s1. If n is omitted, the first occurrence is assumed. If n is negative, the search is made starting from the end of string s1. The result is an integer. The positions in the string are numbered from 1 and up.

Examples:

index( 'abcdefg', 'cd' ) returns 3

index( 'abcdabcd', 'b', 2 ) returns 6

index( 'abcdabcd', 'b', -2 ) returns 2

left( Date, index( Date,'-') -1 ) where Date = 1997-07-14 returns 1997

mid( Date, index( Date, '-', 2 ) -2, 2 ) where Date = 1997-07-14 returns 07

marcus_sommer

Have a look on fieldvalue() and fieldindex() and similar functions.

- Marcus

lavanya14
Contributor III
Contributor III
Author

was able to find the solution for this..