Page 1 of 1

Comparision of String

Posted: Thu Jun 02, 2005 1:48 am
by jayantthakore
I have to give a constraint which compare for a string pattern "product" in the description and reject the record..........
Is there any method to do it.
i have tried the compare function.its not workin.
I need to search the word product in the whole description any if it is present anywhere then reject the record.

Thanks,
Jayant

Posted: Thu Jun 02, 2005 2:30 am
by ArndW
Hello there Jayant,

you can use the INDEX function in PX, the syntax is the same as that for a server job, INDEX(BigString,SearchString,Occurence) -> i.e. INDEX('This is a long string with Product numbers in it','Product',1) will return 28 and it will return a 0 when the SearchString does not occur in the BigString.

Comparision of String

Posted: Thu Jun 02, 2005 3:46 am
by Raghavendra
Jayant,

U can use INDEX function.
Syntax for Index function is Index (string, substring, instance).
This function will return the starting position of the sub string.
If substring is an empty string, 1 is returned. If substring is a null value, 0 is returned.

Posted: Thu Jun 02, 2005 4:43 am
by jayantthakore
Thanks a lot guys the thing is working absolutely fine now.......

Posted: Thu Jun 02, 2005 4:57 am
by ray.wurlod
You may like to convert both the search string and the main string to upper case, in order to perform a case-insensitive search.