<?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: Help: Sum counts from 5 Sql statemtns? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Help-Sum-counts-from-5-Sql-statemtns/m-p/2355404#M121157</link>
    <description>Hi Joe
&lt;BR /&gt;You can create part of your job like this.
&lt;BR /&gt;---Iterate--&amp;gt;tMySqlInput--&amp;gt;tJavaRow
&lt;BR /&gt;Set the schema of tMysqlInput as Image 1.
&lt;BR /&gt;Set the Query of tMysqlInput like this.
&lt;BR /&gt;"select count(id) from "+context.TableName+" where col = 1"
&lt;BR /&gt;Left "Table Name" as "".
&lt;BR /&gt;Then type these code in tJavaRow.
&lt;BR /&gt;Context.sum+=input_row.sum;
&lt;BR /&gt;The default value of Context.sum should be 0.
&lt;BR /&gt;If you have any question, please let me know.
&lt;BR /&gt;Regards,
&lt;BR /&gt;Pedro</description>
    <pubDate>Mon, 19 Mar 2012 02:04:13 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-03-19T02:04:13Z</dc:date>
    <item>
      <title>Help: Sum counts from 5 Sql statemtns?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Help-Sum-counts-from-5-Sql-statemtns/m-p/2355403#M121156</link>
      <description>My project has multiple databases where I run similar SQL commands. 
&lt;BR /&gt;I created a job to run an update statement on these many databases. 
&lt;BR /&gt;Now I'd like to create a QA check to count the numer of rows affected by my job. 
&lt;BR /&gt;Here's my problem: 
&lt;BR /&gt;I have a tMap create the SQL I'd like to run, then I run the command on the database with a tMySqlRow 
&lt;BR /&gt;tMap_2 -&amp;gt; tMySqlRow -&amp;gt; tLogRow 
&lt;BR /&gt;Output: 
&lt;BR /&gt;select count(*) from db1.table where col = 1; 
&lt;BR /&gt;select count(*) from db2.table where col = 1; 
&lt;BR /&gt;select count(*) from db3.table where col = 1; 
&lt;BR /&gt;I can't figure out how to "agregate" or "iterate" or etc the data in my project to sum the results and compare with a number I provide. 
&lt;BR /&gt; 
&lt;BR /&gt;Thanks for looking 
&lt;BR /&gt;-Joe</description>
      <pubDate>Fri, 16 Mar 2012 19:43:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Help-Sum-counts-from-5-Sql-statemtns/m-p/2355403#M121156</guid>
      <dc:creator>_AnonymousUser</dc:creator>
      <dc:date>2012-03-16T19:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: Help: Sum counts from 5 Sql statemtns?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Help-Sum-counts-from-5-Sql-statemtns/m-p/2355404#M121157</link>
      <description>Hi Joe
&lt;BR /&gt;You can create part of your job like this.
&lt;BR /&gt;---Iterate--&amp;gt;tMySqlInput--&amp;gt;tJavaRow
&lt;BR /&gt;Set the schema of tMysqlInput as Image 1.
&lt;BR /&gt;Set the Query of tMysqlInput like this.
&lt;BR /&gt;"select count(id) from "+context.TableName+" where col = 1"
&lt;BR /&gt;Left "Table Name" as "".
&lt;BR /&gt;Then type these code in tJavaRow.
&lt;BR /&gt;Context.sum+=input_row.sum;
&lt;BR /&gt;The default value of Context.sum should be 0.
&lt;BR /&gt;If you have any question, please let me know.
&lt;BR /&gt;Regards,
&lt;BR /&gt;Pedro</description>
      <pubDate>Mon, 19 Mar 2012 02:04:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Help-Sum-counts-from-5-Sql-statemtns/m-p/2355404#M121157</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-03-19T02:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: Help: Sum counts from 5 Sql statemtns?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Help-Sum-counts-from-5-Sql-statemtns/m-p/2355405#M121158</link>
      <description>Thank you for the reply Pedro.&lt;BR /&gt;I created a FlowToIterate object pointing to the tMySQLInput.&lt;BR /&gt;In my picture, out1.sql_command has five results, each are the sql count(*) I'd like to run.&lt;BR /&gt;As you can see in my picture, I've added the tJavaRow with code you provided to sum the resutls from the sql command. &lt;BR /&gt;I'm not certain it is working--when I run the project, the iterate command shows 2 execs finished. I expect 5.</description>
      <pubDate>Mon, 19 Mar 2012 17:55:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Help-Sum-counts-from-5-Sql-statemtns/m-p/2355405#M121158</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-03-19T17:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: Help: Sum counts from 5 Sql statemtns?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Help-Sum-counts-from-5-Sql-statemtns/m-p/2355406#M121159</link>
      <description>Hi&lt;BR /&gt;I don't know why it doesn't work. Maybe this is due to out1.sql_command.&lt;BR /&gt;Could you show me the five sql queries?&lt;BR /&gt;Regards,&lt;BR /&gt;Pedro</description>
      <pubDate>Tue, 20 Mar 2012 02:21:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Help-Sum-counts-from-5-Sql-statemtns/m-p/2355406#M121159</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-03-20T02:21:35Z</dc:date>
    </item>
  </channel>
</rss>

