Page 1 of 1

getting positon of value

Posted: Mon Jun 15, 2009 5:39 am
by ssharmila
can anyone tell me how to get positon of value in a list??

ex, A is an input having value like (1,2,3,4), i want to get the position of 2 in it...how can i implement this? Thanks in advance

Posted: Mon Jun 15, 2009 5:57 am
by Sreenivasulu
Pl Search the documentation or search the forum before posting

Regards
Sreeni

Posted: Mon Jun 15, 2009 6:18 am
by ArndW
If you have a string with the value of "1,2,3,4,5" then the function "FIELD(In.String,',',2) will return the 2nd field as delimited by commas.

Posted: Mon Jun 15, 2009 6:42 am
by chulett
Index() will return the position of a substring within a string, but it sounds like you want to Locate() an array element instead. Check the documentation for the difference.

Posted: Mon Jun 15, 2009 7:09 am
by ArndW
Craig - I recall that the function LOCATE() doesn't work in server transforms, just the "LOCATE x IN y SETTING z" syntax.

Posted: Mon Jun 15, 2009 7:26 am
by chulett
Correct, you'd need to write a custom routine to leverage that. Plus convert all those commas to Field Marks or Value Marks or some kind of dang marks first. :wink:

Posted: Tue Jun 16, 2009 12:28 am
by ssharmila
chulett wrote:Correct, you'd need to write a custom routine to leverage that. Plus convert all those commas to Field Marks or Value Marks or some kind of dang marks first. :wink: ...
Thank you all...I will try to write routine for that