Page 1 of 1

index function

Posted: Wed May 02, 2007 7:25 pm
by seanc217
I know in other non-datastage functions, if you want to search backwards you would specify a negative number. Is this possible with this function?

TIA

Posted: Wed May 02, 2007 7:32 pm
by nick.bond
Not as far as I know but if you test it and find it does it would be interesting to know.

I would approach this by using the Count function to find out how many of the strings there are. If you want the last one use.

Code: Select all

Index (string, substring, Count (string, substring))

Posted: Wed May 02, 2007 11:18 pm
by ray.wurlod
No, the arguments to Index() must be a string, another string and a positive integer. The third argument is an occurrence. You are searching for a substring within a string. The first occurrence of the substring, the second occurrence of the string, and so on. Searching for the -3rd occurrence does not make sense.

Posted: Thu May 03, 2007 11:54 am
by seanc217
OK thanks, I think what I'll count the number of occrurances as suggested.