<?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: how to check if the field exist from input in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/how-to-check-if-the-field-exist-from-input/m-p/2356165#M121755</link>
    <description>Can you clarify?  I am not sure if you are saying all rows must contain value "A_Value" in column A like this:&lt;BR /&gt;A&lt;BR /&gt;A_Value&lt;BR /&gt;A_Value&lt;BR /&gt;A_Value&lt;BR /&gt;Or whether you are saying that there can only be one row with "A_value" like this&lt;BR /&gt;A&lt;BR /&gt;A_Value&lt;BR /&gt;B_Value&lt;BR /&gt;C_Value&lt;BR /&gt;I am a bit slow today but still trying to help</description>
    <pubDate>Tue, 06 Aug 2013 21:38:16 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2013-08-06T21:38:16Z</dc:date>
    <item>
      <title>how to check if the field exist from input</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-check-if-the-field-exist-from-input/m-p/2356164#M121754</link>
      <description>Hi, &lt;BR /&gt;I have another question from data validation. &lt;BR /&gt;That is, the input file must contain one and only one row with a particular field value. Say, a input file must contain one and only one row of field data "A_Value" for column "A".&lt;BR /&gt;I am thinking to use tAggregateRow to get all counts for column A and then check it in tJavaRow. but tJavaRow only processes one row. In this case, I need to get the list of all column counts to check if the list has the one and only row for that column A. &lt;BR /&gt;Is there any way to do this ?&lt;BR /&gt;Thanks !&lt;BR /&gt;James</description>
      <pubDate>Tue, 06 Aug 2013 21:29:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-check-if-the-field-exist-from-input/m-p/2356164#M121754</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-08-06T21:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to check if the field exist from input</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-check-if-the-field-exist-from-input/m-p/2356165#M121755</link>
      <description>Can you clarify?  I am not sure if you are saying all rows must contain value "A_Value" in column A like this:&lt;BR /&gt;A&lt;BR /&gt;A_Value&lt;BR /&gt;A_Value&lt;BR /&gt;A_Value&lt;BR /&gt;Or whether you are saying that there can only be one row with "A_value" like this&lt;BR /&gt;A&lt;BR /&gt;A_Value&lt;BR /&gt;B_Value&lt;BR /&gt;C_Value&lt;BR /&gt;I am a bit slow today but still trying to help</description>
      <pubDate>Tue, 06 Aug 2013 21:38:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-check-if-the-field-exist-from-input/m-p/2356165#M121755</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-08-06T21:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to check if the field exist from input</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-check-if-the-field-exist-from-input/m-p/2356166#M121756</link>
      <description>Thanks for your help.&lt;BR /&gt;It is the second case.&lt;BR /&gt;The columnA could contain any data A_Value, B_Value,BB_value,CCC,.... but the validation requires it must contain the A_value and only allows one.&lt;BR /&gt;James</description>
      <pubDate>Tue, 06 Aug 2013 21:43:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-check-if-the-field-exist-from-input/m-p/2356166#M121756</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-08-06T21:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: how to check if the field exist from input</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-check-if-the-field-exist-from-input/m-p/2356167#M121757</link>
      <description>You *could* use aggregate to find the count and verify the count = 1 for that value.  You don't say what you want to have happen if the validation fails.  Here is a job that will die if validation fails.  This leverages the "run if" capability of talend as well as the exported variable from tFilterRow, NB_LINE_OK.&lt;BR /&gt;Job looks like&lt;BR /&gt;tFixedFlowInput  -&amp;gt; tFilterRow -&amp;gt; tLogRow - run if trigger -&amp;gt; tDie&lt;BR /&gt;tFixedFlowInput generates problem data like this:&lt;BR /&gt;A&lt;BR /&gt;"A_Value"&lt;BR /&gt;"A_Value"&lt;BR /&gt;"B_Value"&lt;BR /&gt;"C_Value"&lt;BR /&gt;tFilterRow filters where A Equals "A_Value"&lt;BR /&gt;tLogRow just logs all the A_Values - this is not important for the job but useful for debugging&lt;BR /&gt;after tLogRow create a RunIf trigger to a tDie component&lt;BR /&gt;My RunIf condition looks like:&lt;BR /&gt;(Integer)globalMap.get("tFilterRow_1_NB_LINE_OK") != 1&lt;BR /&gt;My tDie message looks like:&lt;BR /&gt;"one and only one A_value required found " + globalMap.get("tFilterRow_1_NB_LINE_OK")&lt;BR /&gt;When I run it I get&lt;BR /&gt;one and only one A_value required found 2&lt;BR /&gt;.-------.&lt;BR /&gt;|tLogRow_1|&lt;BR /&gt;|=-----=|&lt;BR /&gt;|A      |&lt;BR /&gt;|=-----=|&lt;BR /&gt;|A_Value|&lt;BR /&gt;|A_Value|&lt;BR /&gt;'-------'&lt;BR /&gt;Let me know what questions you have</description>
      <pubDate>Tue, 06 Aug 2013 22:12:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-check-if-the-field-exist-from-input/m-p/2356167#M121757</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-08-06T22:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to check if the field exist from input</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-check-if-the-field-exist-from-input/m-p/2356168#M121758</link>
      <description>Here is an image of the job if that helps 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MEob.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/152503iF4C15FDDAE1F25F5/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MEob.png" alt="0683p000009MEob.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Tue, 06 Aug 2013 22:14:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-check-if-the-field-exist-from-input/m-p/2356168#M121758</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-08-06T22:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to check if the field exist from input</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-check-if-the-field-exist-from-input/m-p/2356169#M121759</link>
      <description>Thanks for your reply.
&lt;BR /&gt;After it fails, I need to log the file into a table (record rejected files). If it is valid, it will be continued to normal parsing process.
&lt;BR /&gt;I am thinking of using tAggregate because there are multiple columns to be verified. Some columns could not exceeds some number, say 5 rows.
&lt;BR /&gt;Yes, the tFilter is an option but this needs multiple filters. I wonder if I could use one tJavaRow to validate all of columns. If I could get the list of all counts, I could 1) check if the particular value exists and 2) check its counts if it exists by loop them all. This could check multiple columns in one loop.
&lt;BR /&gt;The question is : is there a way to get a the list of tJava ? If not, is there way to validate multiple column by one process instead of multiple processes(filters) ?
&lt;BR /&gt;James</description>
      <pubDate>Tue, 06 Aug 2013 22:40:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-check-if-the-field-exist-from-input/m-p/2356169#M121759</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-08-06T22:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: how to check if the field exist from input</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-check-if-the-field-exist-from-input/m-p/2356170#M121760</link>
      <description>Yes, you can use tJavaFlex to increment a number of variables based on your different test conditions for each row and then RunIf to test the results and determine what action to take e.g.
&lt;BR /&gt;
&lt;U&gt;tJavaFlex Start code&lt;/U&gt;
&lt;BR /&gt;Integer count1 = 0;
&lt;BR /&gt;Integer count2 = 0;
&lt;BR /&gt;
&lt;U&gt;tJavaFlex Main code&lt;/U&gt;
&lt;BR /&gt;count1 += A_Value.equals(row1.A)?1:0;
&lt;BR /&gt;count2 += B_Value.equals(row1.B)?1:0;
&lt;BR /&gt;
&lt;U&gt;RunIf&lt;/U&gt;
&lt;BR /&gt;count1 == 1 &amp;amp;&amp;amp; count2 &amp;lt;= 5</description>
      <pubDate>Wed, 07 Aug 2013 00:14:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-check-if-the-field-exist-from-input/m-p/2356170#M121760</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2013-08-07T00:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to check if the field exist from input</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-check-if-the-field-exist-from-input/m-p/2356171#M121761</link>
      <description>This is what I exactly wanted. Thanks a lot. 
&lt;BR /&gt;By the way, the "count1 += A_Value.equals(row1.A);" did not work. It give the error of "The operator += is undefined for the argument type(s) int, boolean". But I got what you meant, I just and "if" block. 
&lt;BR /&gt;Thanks again, 
&lt;BR /&gt;James</description>
      <pubDate>Wed, 07 Aug 2013 14:29:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-check-if-the-field-exist-from-input/m-p/2356171#M121761</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-08-07T14:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to check if the field exist from input</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-check-if-the-field-exist-from-input/m-p/2356172#M121762</link>
      <description>Quite right; I fixed it.</description>
      <pubDate>Thu, 08 Aug 2013 00:28:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-check-if-the-field-exist-from-input/m-p/2356172#M121762</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2013-08-08T00:28:18Z</dc:date>
    </item>
  </channel>
</rss>

