Page 1 of 1

A Value Search in a String

Posted: Thu Dec 28, 2006 5:54 pm
by sas
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.

Posted: Thu Dec 28, 2006 6:06 pm
by I_Server_Whale
Welcome Aboard ! :)

You can substring the incoming strings for Qty's and then use stage variables to be flagged according to your logic.


Whale.

Posted: Thu Dec 28, 2006 8:25 pm
by ray.wurlod
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?

Posted: Thu Dec 28, 2006 11:49 pm
by sas
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.

Posted: Fri Dec 29, 2006 12:58 am
by ray.wurlod
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?

Posted: Fri Dec 29, 2006 8:44 am
by DSguru2B
A picture ='s thousand words. Did i get that right, i think i did. So yes, as i was saying, give an an example of your sample data, and what should be the output for each and every condition.

Posted: Fri Dec 29, 2006 2:03 pm
by us1aslam1us
Your second post is very confusing. What is 'Category' and 'real qty'? And how are you deciding the real qty from the first string? what will be the length of Qty field(eg. 20,30,30000)? Without the Sample data or prper information it will be impossible to speculate and suggest you something?

Sam

Posted: Fri Dec 29, 2006 3:02 pm
by I_Server_Whale
DSguru2B wrote:A picture ='s thousand words. Did i get that right, i think i did.
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:

Posted: Fri Dec 29, 2006 4:30 pm
by us1aslam1us
i = ?

Sam

Posted: Fri Dec 29, 2006 4:33 pm
by DSguru2B
I_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:
Cute. I was referring to the proverb :wink: