Find Strings in a String Field
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 135
- Joined: Tue Aug 14, 2007 4:27 am
- Location: Mumbai
Find Strings in a String Field
How can I find multiple strings in a String column.
in sql we can use --
select xyz from abc
where UPPER(DESC) like '%MANGO%ORANGE%'
Read some of the old post here and found that I can use index function to find a string in string field.
Is there any specific function available to search multiple strings ?
In the mean time i can use index function twice to achive my logic..
but what if i have more strings to be searched in one field. More if else ??
in sql we can use --
select xyz from abc
where UPPER(DESC) like '%MANGO%ORANGE%'
Read some of the old post here and found that I can use index function to find a string in string field.
Is there any specific function available to search multiple strings ?
In the mean time i can use index function twice to achive my logic..
but what if i have more strings to be searched in one field. More if else ??
Thanks
Swapnil
"Whenever you find whole world against you just turn around and Lead the world"
Swapnil
"Whenever you find whole world against you just turn around and Lead the world"
-
- Participant
- Posts: 133
- Joined: Wed Mar 05, 2003 4:19 pm
- Location: Lima - Peru. Sudamerica
- Contact:
Re: Find Strings in a String Field
Hi swapnilverma,
The index function returns the position of a substring within a string, for your case:
this select:
select xyz from abc
WHERE UPPER (DESC) like '% MANGO% ORANGE%'
you can use the function as follows:
Index (UPPER (DESC) 'MANGO', 1) > 0 and Index (UPPER (DESC) 'ORANGE', 1) > 0
and return the records that matches both substrings
The index function returns the position of a substring within a string, for your case:
this select:
select xyz from abc
WHERE UPPER (DESC) like '% MANGO% ORANGE%'
you can use the function as follows:
Index (UPPER (DESC) 'MANGO', 1) > 0 and Index (UPPER (DESC) 'ORANGE', 1) > 0
and return the records that matches both substrings
Saludos,
Miguel Seclén
Lima - Peru
Miguel Seclén
Lima - Peru
-
- Participant
- Posts: 135
- Joined: Tue Aug 14, 2007 4:27 am
- Location: Mumbai
The only thing I can think of that would do that is matches but the problem is I don't believe it is a valid PX function. You'd have to use a BASIC Transformer or a Server Shared Container to bring that functionality into your job from what I recall.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
There's nothing out of the box in the parallel Transformer stage for searching for multiple string. Matches (in a BASIC Transformer stage) would do it. Or you could write your own parallel routine. A probably slower option would be an External Filter stage, that could use regular expressions to report a match/non-match result.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Information Analyzer (8.1.2 or later) has a matches_regex data rule available. It would be interesting to inspect the osh script that is generated from a data rule job that uses this, to see which operator is invoked. Alas, I'm not currently in a position to do that.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
That's not quite right---there's only one cat.
DCount counts the number of delimited fields in the first argument based on the delimiter specified in the second argument. There are two fields defined by the delimiter "cat".
I believe the easiest options to implement are the two Index() example given earlier or the Matches function in a BASIC transformer.
Regards,
DCount counts the number of delimited fields in the first argument based on the delimiter specified in the second argument. There are two fields defined by the delimiter "cat".
I believe the easiest options to implement are the two Index() example given earlier or the Matches function in a BASIC transformer.
Regards,
- james wiles
All generalizations are false, including this one - Mark Twain.
All generalizations are false, including this one - Mark Twain.
-
- Participant
- Posts: 135
- Joined: Tue Aug 14, 2007 4:27 am
- Location: Mumbai