<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Multiple Conditions String in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Multiple-Conditions-String/m-p/2308038#M79413</link>
    <description>&lt;P&gt;You may not have any compilation errors, but that will not work as you expect. If you take the code I gave you and wrap it into a routine (&lt;A href="https://community.qlik.com/s/article/ka03p0000006EZrAAM" target="_blank"&gt;https://community.talend.com/t5/Design-and-Development/Create-a-user-routine-and-call-it-in-a-Job/ta-p/21665&lt;/A&gt;), you can try the below in your tMap. I am assuming your routine is called "MyRoutines", your method is called "isValueInList", it takes 2 parameters (your input data and a search list) and it outputs a boolean (true or false) if the value is found. This is how the code I gave you yesterday would naturally fit into a routine.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;row5.RHTFRM==null || &lt;BR /&gt;routines.MyRoutines.findValueInList(row5.RHTFRM,"DE101,DE209,DE401,DE501,DE502,DE503,DE504,DE506,DE507,DE601,DE603,EU.*,RW.*" ?&lt;BR /&gt;"DE_NOTAP_CD" : ("DE_"+ row5.RGSENTART + "_CD")&lt;/PRE&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Jan 2018 10:01:14 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-01-17T10:01:14Z</dc:date>
    <item>
      <title>Multiple Conditions String</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Multiple-Conditions-String/m-p/2308032#M79407</link>
      <description>&lt;P&gt;Hey Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following in my tMap:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;row5.RHTFRM==("502") &amp;amp;&amp;amp;&lt;BR /&gt;row5.RGSENTNR==null?&lt;BR /&gt;"DE_NOTAP_CD":&lt;BR /&gt;"DE_"+ row5.RGSENTART + "_CD"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so far so good, no errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I want multiple checks,that means - besides of 502 -&amp;nbsp; I want to check via or 503, 504 etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess this is quite simple, but I can't get any clue about this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your Help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 15:53:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Multiple-Conditions-String/m-p/2308032#M79407</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-16T15:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Conditions String</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Multiple-Conditions-String/m-p/2308033#M79408</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;C&lt;/P&gt; 
&lt;P&gt;an you be a little more explicit with an example (sample data with expected result)?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 16:13:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Multiple-Conditions-String/m-p/2308033#M79408</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2018-01-16T16:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Conditions String</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Multiple-Conditions-String/m-p/2308034#M79409</link>
      <description>&lt;P&gt;There are two problems here. The first has been mentioned by&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/0053p000007LKj7AAG"&gt;@TRF&lt;/A&gt;. Essentially are you looking to compare to a fixed, unchanging list of values or are you wanting to compare to potentially dynamic values?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;The second problem is probably less obvious, but should be looked at as a priority. You are using the == operator for equality of Strings. This is NOT a good idea in Java. To show this, try the following code in a tJava component....&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;String test1 = new String("502");
String test2 = new String("502");
String test3 = "502";

System.out.println("test1 value compared to 502 using ==");
if(test1=="502"){
	System.out.println("PASS");
}else{
	System.out.println("FAIL");
}

System.out.println("test2 value compared to test1 using ==");
if(test2==test1){
	System.out.println("PASS");
}else{
	System.out.println("FAIL");
}

System.out.println("test3 value compared to 502 using ==");
if(test3=="502"){
	System.out.println("PASS");
}else{
	System.out.println("FAIL");
}


System.out.println("test1 value compared to 502 using equals()");
if(test1.equals("502")){
	System.out.println("PASS");
}else{
	System.out.println("FAIL");
}

System.out.println("test2 value compared to test1 using equals()");
if(test2.equals(test1)){
	System.out.println("PASS");
}else{
	System.out.println("FAIL");
}

System.out.println("test3 value compared to 502 using equals()");
if(test3.equals("502")){
	System.out.println("PASS");
}else{
	System.out.println("FAIL");
}&lt;/PRE&gt; 
&lt;P&gt;This is due to == testing whether it is the same object and equals() tests to see that it is the same value. It is like saying that 2 identical cars are the same car. == asks are they physically the same objects (in the case of the cars that is FALSE). Equals() asks are they the same car (as in make, model, colour, etc)?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;It is an important distinction to make&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 16:22:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Multiple-Conditions-String/m-p/2308034#M79409</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-16T16:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Conditions String</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Multiple-Conditions-String/m-p/2308035#M79410</link>
      <description>&lt;P&gt;ok agree with you, I will use "equals"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Requirement is:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If&lt;/P&gt;&lt;P&gt;row2.Field10 is&lt;/P&gt;&lt;P&gt;&amp;nbsp; DE101, DE209, DE401, DE501, DE502, DE503, DE504, DE506, DE507, DE601, DE603&amp;nbsp; or EU* or RW*&lt;/P&gt;&lt;P&gt;and&amp;nbsp;&lt;/P&gt;&lt;P&gt;row2.Field11 equals null&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; than "DE_NOTAP_CD"&lt;/P&gt;&lt;P&gt;otherwise&lt;/P&gt;&lt;P&gt;&amp;nbsp; DE_row2.Field12_CD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this will make it clearer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 16:36:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Multiple-Conditions-String/m-p/2308035#M79410</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-16T16:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Conditions String</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Multiple-Conditions-String/m-p/2308036#M79411</link>
      <description>&lt;P&gt;Will....&lt;/P&gt;
&lt;PRE&gt;DE101, DE209, DE401, DE501, DE502, DE503, DE504, DE506, DE507, DE601, DE603  or EU* or RW*&lt;/PRE&gt;
&lt;P&gt;...be a fixed list, or dynamic? Do you want to be able to use wildcards (*)?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regardless of whether you want the comparable values to be dynamic or not, you can do it with a bit of Java like below. I have made some changes to your compare values. I have ensured that they are regex compliant. SO your wildcard values are now changed. You will see what I've done.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you wrap the below code into a routine with two input parameters (your value and the list to compare to), you can return the&amp;nbsp;String (or wildcard String) that your input value matched to. It may need some tidying up, but this should go some way to helping you solve this...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;String input = "DE101,DE209,DE401,DE501,DE502,DE503,DE504,DE506,DE507,DE601,DE603,EU.*,RW.*";

String data = "EUdhjhd7";

String[] tokens = input.split(",");

boolean notFound = true;

String tokenMatched = "";

for(int i = 0; i&amp;lt;tokens.length &amp;amp;&amp;amp; notFound; i++){
	java.util.regex.Pattern p =  java.util.regex.Pattern.compile(tokens[i]);
	java.util.regex.Matcher m = p.matcher(data);
	
	if(m.matches()){
		notFound = false;
		tokenMatched = tokens[i];
	}

}

System.out.println(tokenMatched);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 17:40:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Multiple-Conditions-String/m-p/2308036#M79411</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-16T17:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Conditions String</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Multiple-Conditions-String/m-p/2308037#M79412</link>
      <description>&lt;P&gt;thanks for your relpy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DE101, DE209, DE401, DE501, DE502, DE503, DE504, DE506, DE507, DE601, DE60&lt;/PRE&gt;&lt;P&gt;are fixed and&lt;/P&gt;&lt;PRE&gt;EU* or RW*&lt;/PRE&gt;&lt;P&gt;are Wildcards.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried this in my tMap and get no compilation errors:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(row5.RHTFRM.equals("502,DE101,DE209,DE401,DE501,DE502,DE503,DE504,DE506,DE507,DE601,DE603") ||&lt;BR /&gt;row5.RGSENTNR==null &amp;amp;&amp;amp;&lt;BR /&gt;row5.RHTFRM.equals("EU.*,RW.*"))?&lt;BR /&gt;&lt;BR /&gt;"DE_NOTAP_CD":&lt;BR /&gt;&lt;BR /&gt;("DE_"+ row5.RGSENTART + "_CD")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2018 08:43:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Multiple-Conditions-String/m-p/2308037#M79412</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-17T08:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Conditions String</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Multiple-Conditions-String/m-p/2308038#M79413</link>
      <description>&lt;P&gt;You may not have any compilation errors, but that will not work as you expect. If you take the code I gave you and wrap it into a routine (&lt;A href="https://community.qlik.com/s/article/ka03p0000006EZrAAM" target="_blank"&gt;https://community.talend.com/t5/Design-and-Development/Create-a-user-routine-and-call-it-in-a-Job/ta-p/21665&lt;/A&gt;), you can try the below in your tMap. I am assuming your routine is called "MyRoutines", your method is called "isValueInList", it takes 2 parameters (your input data and a search list) and it outputs a boolean (true or false) if the value is found. This is how the code I gave you yesterday would naturally fit into a routine.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;row5.RHTFRM==null || &lt;BR /&gt;routines.MyRoutines.findValueInList(row5.RHTFRM,"DE101,DE209,DE401,DE501,DE502,DE503,DE504,DE506,DE507,DE601,DE603,EU.*,RW.*" ?&lt;BR /&gt;"DE_NOTAP_CD" : ("DE_"+ row5.RGSENTART + "_CD")&lt;/PRE&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2018 10:01:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Multiple-Conditions-String/m-p/2308038#M79413</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-17T10:01:14Z</dc:date>
    </item>
  </channel>
</rss>

