Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
NavinReddy
Creator II
Creator II

Index

Hi All,

Im little bit confuse to know Index

Could you please some one explain me What is Index

Where Can We use in Script

Thanks in Advance

Niranjan

2 Replies
Not applicable

hi

About Index--

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

NavinReddy
Creator II
Creator II
Author

Hi vishwa,

Here im straggle to understand  "index( 'abcdabcd', 'b', -2 ) returns 2"

the purpose -2, index( Date,'-') -1 ,this both syntax i cant able to understand

will you plz explian


Thanks & Regards

Niranjan