A Value Search in a String
Moderators: chulett, rschirm, roy
A Value Search in a String
I have following 2 strings columns coming into the transformer -
String1 = "Qty1,Score1|Qty2,Score2|Qty3,Score3|.......|Qty20,Score20"
String2 = "Qty1,Score1|Qty2,Score2|Qty3,Score3|.......|Qty20,Score20"
I need to find out if there is a tie between Qty across these two String Columns i.e. any Qty is common in String1 and String2. E.g. If Qty2 of String1 is 30 - How would I find out whether this 30 is present in any of the String2 Qty out of those 20 String2 Qty. I am avoiding taking each Qty of String1 and compare String2 Qty. Looking for more efficient way to do in the same transformer.
String1 = "Qty1,Score1|Qty2,Score2|Qty3,Score3|.......|Qty20,Score20"
String2 = "Qty1,Score1|Qty2,Score2|Qty3,Score3|.......|Qty20,Score20"
I need to find out if there is a tie between Qty across these two String Columns i.e. any Qty is common in String1 and String2. E.g. If Qty2 of String1 is 30 - How would I find out whether this 30 is present in any of the String2 Qty out of those 20 String2 Qty. I am avoiding taking each Qty of String1 and compare String2 Qty. Looking for more efficient way to do in the same transformer.
-
- Premium Member
- Posts: 1255
- Joined: Wed Feb 02, 2005 11:54 am
- Location: United States of America
Welcome Aboard ! ![Smile :)](./images/smilies/icon_smile.gif)
You can substring the incoming strings for Qty's and then use stage variables to be flagged according to your logic.
Whale.
![Smile :)](./images/smilies/icon_smile.gif)
You can substring the incoming strings for Qty's and then use stage variables to be flagged according to your logic.
Whale.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
What are the scores doing in all of this? Is it the Qty values or the Score values being compared? Can you provide a couple of examples with numbers and a description of the expected outcomes, one where there is a match and one where there isn't? Are you prepared to countenance a solution that does not use a single Transformer stage and, if not, why not?
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.
Ray - Thanks a lot for your attention. We do have these 80 columns in available (other process is calculating them). These String1 and String2 is formed in the Transformer based on the predefined categories in order to address different conditions. Examples of some conditions -
(1) Perform different set of activities if Category1/String1 has only one set (1 Qty and 1 Score) and Category2/String2 has also only one set and both the quantities are equal. Counting of | sign tells me how many sets are present instead of scanning all the different columns.
(2) Perform different activities if category1/String1 has only one set (1 Qty and 1 Score) and Category2/String2 has also only one set and both the quantities are NOT equal and Score of String1 is greater than Score of String2 (other way round of the score differece will make another condition)
(3) Perform different set of activities if category1/String1 has more than one sets and Category2/String2 has also more than one sets and "real qty" is matching in both categories. I am simply scanning "real qty" in String1 and String2 to get the answer.
(4) Perform different set of activities if category1/String1 has more than one sets and category2/String2 has also more than one sets and "real qty" is NOT matching in String2. (Match in String2 is another condition)
(5) Perform different set of activities if category1/String1 has more than one sets and Category2/String2 has also more than one sets and "real qty" is NOT matching in both categories and check if there is Qty tie between Qty String1 and Qty String2. This is condition where I am seeking your help and expert advise.
The reason to have the score after each qty because I have to pass the Score to other process of the selected qty.
(1) Perform different set of activities if Category1/String1 has only one set (1 Qty and 1 Score) and Category2/String2 has also only one set and both the quantities are equal. Counting of | sign tells me how many sets are present instead of scanning all the different columns.
(2) Perform different activities if category1/String1 has only one set (1 Qty and 1 Score) and Category2/String2 has also only one set and both the quantities are NOT equal and Score of String1 is greater than Score of String2 (other way round of the score differece will make another condition)
(3) Perform different set of activities if category1/String1 has more than one sets and Category2/String2 has also more than one sets and "real qty" is matching in both categories. I am simply scanning "real qty" in String1 and String2 to get the answer.
(4) Perform different set of activities if category1/String1 has more than one sets and category2/String2 has also more than one sets and "real qty" is NOT matching in String2. (Match in String2 is another condition)
(5) Perform different set of activities if category1/String1 has more than one sets and Category2/String2 has also more than one sets and "real qty" is NOT matching in both categories and check if there is Qty tie between Qty String1 and Qty String2. This is condition where I am seeking your help and expert advise.
The reason to have the score after each qty because I have to pass the Score to other process of the selected qty.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
That's even more confusing! Please supply examples WITH NUMBERS as requested.
Does there exists a written specification for this logic? That is, some form of target-from-source mapping document?
Your terminology is also confusing. At one moment you are referring to a Transformer - at the next moment you are referring to an activity. The first belongs in a job, the second in a job sequence.
Which is it? On the basis of that answer, please clarify what you mean by the inappropriate term. For example are you using a Nested Condition activity in a job sequence (not a Transformer)? Or do you mean "separate processing stream" or "separate output link" when your context is a job?
Does there exists a written specification for this logic? That is, some form of target-from-source mapping document?
Your terminology is also confusing. At one moment you are referring to a Transformer - at the next moment you are referring to an activity. The first belongs in a job, the second in a job sequence.
Which is it? On the basis of that answer, please clarify what you mean by the inappropriate term. For example are you using a Nested Condition activity in a job sequence (not a Transformer)? Or do you mean "separate processing stream" or "separate output link" when your context is a job?
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.
-
- Charter Member
- Posts: 822
- Joined: Sat Sep 17, 2005 5:25 pm
- Location: USA
-
- Premium Member
- Posts: 1255
- Joined: Wed Feb 02, 2005 11:54 am
- Location: United States of America
Well! If you are really looking for an answer. Then,DSguru2B wrote:A picture ='s thousand words. Did i get that right, i think i did.
Code: Select all
i <> I , Where 'I' refers to the nominative singular pronoun, used by a speaker in referring to himself or herself. .
![Wink :wink:](./images/smilies/icon_wink.gif)
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
Cute. I was referring to the proverbI_Server_Whale wrote: Well! If you are really looking for an answer. Then,
Code: Select all
i <> I , Where 'I' refers to the nominative singular pronoun, used by a speaker in referring to himself or herself. .
![Wink :wink:](./images/smilies/icon_wink.gif)
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.