<?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: [resolved] How to insert a counter to evaluate correct and incorrect rows in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207825#M7303</link>
    <description>And don't ever use tJava connected by rows as the code is executed before the rows even start.</description>
    <pubDate>Tue, 02 Oct 2012 09:48:25 GMT</pubDate>
    <dc:creator>alevy</dc:creator>
    <dc:date>2012-10-02T09:48:25Z</dc:date>
    <item>
      <title>[resolved] How to insert a counter to evaluate correct and incorrect rows</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207822#M7300</link>
      <description>Hi ! 
&lt;BR /&gt; 
&lt;B&gt; here's the context :&lt;/B&gt; 
&lt;BR /&gt;- i have a txt file with more than 200k lines. 
&lt;BR /&gt;- it is a positional file, correctly entered in talend (74 columns) 
&lt;BR /&gt;- each line has a fixed string content, then a variable one (depends on entries before). 
&lt;BR /&gt; 
&lt;B&gt;In addition&lt;/B&gt;, some lines are not properly entered, and we don't need to include these lines in our datamining project. 
&lt;BR /&gt; 
&lt;U&gt;I want to count the number of correct line and incorrect line&lt;/U&gt;, so after the positionalFile, i put a tJava initiliazing the 2 counters (int correct and int incorrect) , then i put a tJavaRow where i increment the variables when the conditions are met, then i put a tJava to println the variables. 
&lt;BR /&gt;The problem is that the last tJava 
&lt;B&gt; doesn't recognize the variables.&lt;/B&gt; 
&lt;BR /&gt;I tried to make them global, but it is not working. 
&lt;BR /&gt;I tried to insert it in the tJavaRow but, they print in each line read the values... 
&lt;U&gt;it works but it is not clean&lt;/U&gt;.. 
&lt;BR /&gt;If anyone have a good way to do so, 
&lt;U&gt;it would help me a lot !&lt;/U&gt; 
&lt;BR /&gt;Thank you !</description>
      <pubDate>Mon, 01 Oct 2012 14:22:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207822#M7300</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-10-01T14:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to insert a counter to evaluate correct and incorrect rows</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207823#M7301</link>
      <description>hi&lt;BR /&gt;first try to use dedicated Talend component and not tjava or tjava row (if you can of course).&lt;BR /&gt;use for example tSchemaComplianceCheck to conforme your data structure.&lt;BR /&gt;you can also use filter row &lt;BR /&gt;you could also use the "reject flow" from those differents components.&lt;BR /&gt;Try the reject flow from your tfileInputPositionnal for ex.&lt;BR /&gt;And use values that Talend 's already stored for you (hava a look at "outline" - bottom left &lt;BR /&gt;hope it helps&lt;BR /&gt;regards&lt;BR /&gt;laurent</description>
      <pubDate>Mon, 01 Oct 2012 17:23:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207823#M7301</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-10-01T17:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to insert a counter to evaluate correct and incorrect rows</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207824#M7302</link>
      <description>Thank you, i will check this first time tomorrow and let you know.</description>
      <pubDate>Mon, 01 Oct 2012 17:27:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207824#M7302</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-10-01T17:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to insert a counter to evaluate correct and incorrect rows</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207825#M7303</link>
      <description>And don't ever use tJava connected by rows as the code is executed before the rows even start.</description>
      <pubDate>Tue, 02 Oct 2012 09:48:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207825#M7303</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2012-10-02T09:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to insert a counter to evaluate correct and incorrect rows</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207826#M7304</link>
      <description>Hi, 
&lt;BR /&gt;If I understood this right, you want to count the number of lines rejected and the number of lines accepted(which pass schema check) right? If that is the case, your job should look like this: 
&lt;BR /&gt;You will need 2 context variables - one for the number of rows rejected and one for the number of lines accepted 
&lt;BR /&gt;tFileInputDelimited_1 --&amp;gt; tjava 
&lt;BR /&gt; onsubjobok 
&lt;BR /&gt;| 
&lt;BR /&gt;tFileOutputDelimited_2(rejects) 
&lt;BR /&gt;In the tjava component, you fill in the context variables with the values as fallows: 
&lt;BR /&gt;context.rejected_number_of_lines=((Integer)globalMap.get("tFileOutputDelimited_1_NB_LINE")); 
&lt;BR /&gt;context.acc_number_of_lines=((Integer)globalMap.get("tFileInputDelimited_1_NB_LINE"))-context.rejected_number_of_lines; 
&lt;BR /&gt;Those above are some system variables defined automatically for those 2 components(file input and fileoutput). You can find context variables, system variables defined for components, etc by pressing ctrl+space in editable fields. 
&lt;BR /&gt;Hope this helps. 
&lt;BR /&gt;Regards.</description>
      <pubDate>Tue, 02 Oct 2012 10:21:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207826#M7304</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-10-02T10:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to insert a counter to evaluate correct and incorrect rows</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207827#M7305</link>
      <description>Hello again,
&lt;BR /&gt;today i 've added a 
&lt;U&gt;tFilterRow&lt;/U&gt; after the 
&lt;U&gt;inputFilePositionnal&lt;/U&gt;, then 
&lt;U&gt;2 tFileRowCount&lt;/U&gt; to count the filtered and rejected rows.
&lt;BR /&gt;(schema 
&lt;U&gt;attached images&lt;/U&gt;)
&lt;BR /&gt;In the tFilterRow, i've added the following code to check if the lenght of the variable part is equal to it's supposed lenght by calculating the lenght of animals+cats+dogs part.
&lt;BR /&gt;
&lt;PRE&gt;((input_row.variableContent.length())==&lt;BR /&gt;(40*Integer.parseInt(input_row.nb_animals)&lt;BR /&gt;+6*Integer.parseInt(input_row.nb_cats)&lt;BR /&gt;+22*Integer.parseInt(input_row.nb_dogs)))&lt;/PRE&gt;
&lt;BR /&gt;But i have a failure in generating the code from Talend 
&lt;B&gt;&lt;/B&gt;
&lt;BR /&gt;I think the interpreter can't generate such complicated condition.</description>
      <pubDate>Tue, 02 Oct 2012 10:44:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207827#M7305</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-10-02T10:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to insert a counter to evaluate correct and incorrect rows</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207828#M7306</link>
      <description>&lt;BLOCKQUOTE&gt;
 &lt;TABLE border="1"&gt;
  &lt;TBODY&gt;
   &lt;TR&gt;
    &lt;TD&gt;Hi,&lt;BR /&gt;If I understood this right, you want to count the number of lines rejected and the number of lines accepted(which pass schema check) right?&lt;/TD&gt;
   &lt;/TR&gt;
  &lt;/TBODY&gt;
 &lt;/TABLE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;BR /&gt;it's not completely right, the lines can pass the schema check, but can be wrong depends on its real value.
&lt;BR /&gt;You can see the condition in the above post.</description>
      <pubDate>Tue, 02 Oct 2012 10:51:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207828#M7306</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-10-02T10:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to insert a counter to evaluate correct and incorrect rows</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207829#M7307</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;And don't ever use tJava connected by rows as the code is executed before the rows even start.&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;The first tJava was to initialize the counter (int correct / incorrect) , then the tJavaRow to increment, and the last tJava to println . 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;Well, it was very messy 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Tue, 02 Oct 2012 11:21:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207829#M7307</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-10-02T11:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to insert a counter to evaluate correct and incorrect rows</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207830#M7308</link>
      <description>omg that was stupid to use the tRowCount TT sorry !!&lt;BR /&gt;i'm correcting it using what Neinfrantu said, brb !</description>
      <pubDate>Tue, 02 Oct 2012 13:45:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207830#M7308</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-10-02T13:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to insert a counter to evaluate correct and incorrect rows</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207831#M7309</link>
      <description>I don`t understand exactly what is the condition that must be satisfied by the rows. But I can think of a solution as fallows: 
&lt;BR /&gt;tjavrow -&amp;gt; main -&amp;gt;tfilterrow -&amp;gt;main -&amp;gt; outcomponent 
&lt;BR /&gt; |rej 
&lt;BR /&gt; outcomponent 
&lt;BR /&gt;edit schema of tjavarow and add a boolean type column and set the flag to 1 if condition/conditions are met and verify the condition: 
&lt;BR /&gt;If(condition) 
&lt;BR /&gt;out_row.flag=1; 
&lt;BR /&gt;else 
&lt;BR /&gt;out_row.flag=0; 
&lt;BR /&gt;(you can also use a tfiltercolumns if you want to get rid of this new column afterwards) 
&lt;BR /&gt;(also don`t forget to set all the other columns: out_row.col1=in_row.col1; etc) 
&lt;BR /&gt;Tfilterrow also has system defined variables which retain the number of rows which pass the filter and of those which didn`t. 
&lt;BR /&gt;(optional tfiltercolumns) 
&lt;BR /&gt;So the whole job could look like: 
&lt;BR /&gt;tFileInputDelimited_1 --&amp;gt;main--&amp;gt;tjavrow -&amp;gt; main -&amp;gt;tfilterrow -&amp;gt;main -&amp;gt;(tfiltercolumns)-&amp;gt; outcomponent 
&lt;BR /&gt;|rej |rej 
&lt;BR /&gt;outcomponent outcomp 
&lt;BR /&gt;|| onsubjobok 
&lt;BR /&gt;V 
&lt;BR /&gt;tjava (to set those context variables with the predefined values from components) 
&lt;BR /&gt; 
&lt;BR /&gt;Regards, 
&lt;BR /&gt;Razvan</description>
      <pubDate>Tue, 02 Oct 2012 14:12:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207831#M7309</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-10-02T14:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to insert a counter to evaluate correct and incorrect rows</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207832#M7310</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;tjavrow -&amp;gt; main -&amp;gt;tfilterrow -&amp;gt;main -&amp;gt; outcomponent&lt;BR /&gt; |rej&lt;BR /&gt; outcomponent&lt;BR /&gt;edit schema of tjavarow and add a boolean type column and set the flag to 1 if condition/conditions are met and verify the condition:&lt;BR /&gt;If(condition)&lt;BR /&gt;out_row.flag=1;&lt;BR /&gt;else &lt;BR /&gt;out_row.flag=0;&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;exactly the right thing to do ! working perfectly and i find the same results as with my messy way 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;You can find a screenshot showing the work in attached. 
&lt;BR /&gt;thank you , you rock !</description>
      <pubDate>Tue, 02 Oct 2012 15:54:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-insert-a-counter-to-evaluate-correct-and/m-p/2207832#M7310</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-10-02T15:54:35Z</dc:date>
    </item>
  </channel>
</rss>

