Page 1 of 1

String search

Posted: Tue Jul 21, 2009 8:42 am
by lmandhadi
I have column history. I need to find out a particuler charcter in a column value, if the value is present then i will pass preior value of the charcter else i need to pass last charcter.

Example: Values are presented like
HIST_ID HISTORY
1 'AAAAAAAAAD'
2 'ABCBHBAAAA'
Search value is 'H'

If 'H' is present in a field i need to pass preior value i.e 'B'. If 'H' is not present in the field i need to pass right most value 'D'.

regards
mandhadi

Posted: Tue Jul 21, 2009 8:51 am
by Sainath.Srinivasan
Try index()

Posted: Tue Jul 21, 2009 9:56 am
by efxuser
I tried with index but its working only for 2 condition.
I mean if the value having 'H' then its working other wise job getting abort.

Posted: Tue Jul 21, 2009 10:01 am
by ArndW
The function Index(In.HIST_ID HISTORY ,"H",1) will return a 0 if there is no "H" in the string or the starting position if it exists. No errors are returned.