<?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: count records in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/count-records/m-p/2201178#M3369</link>
    <description>I created joblet like 
&lt;BR /&gt;INPUT -&amp;gt; toracleinput-&amp;gt;tsetglobavar-&amp;gt;output 
&lt;BR /&gt;toracleinput - I gave query like this select count(*) as numofrecords from context.tablename 
&lt;BR /&gt;tsetglobavar - key numofrecords values row1.numofrecords 
&lt;BR /&gt; 
&lt;BR /&gt;INSIDE JOB1 
&lt;BR /&gt;JOBLET -&amp;gt;run if -&amp;gt;TABLE1-&amp;gt;TMAP-&amp;gt;TABLE1_DM 
&lt;BR /&gt;where to provide the value for context.tablename 
&lt;BR /&gt;I am really not clear... can anyone provide a sample flow</description>
    <pubDate>Tue, 31 Jul 2012 01:11:42 GMT</pubDate>
    <dc:creator>_AnonymousUser</dc:creator>
    <dc:date>2012-07-31T01:11:42Z</dc:date>
    <item>
      <title>count records</title>
      <link>https://community.qlik.com/t5/Talend-Studio/count-records/m-p/2201174#M3365</link>
      <description>I have a requirement where if the table has no data then I should not run that specific job. Is there a component that I can use to check for number of records. Like if count(*) = 0 then end the job else complete the run.
&lt;BR /&gt;Can somebody show me an example?
&lt;BR /&gt;MASTER JOB
&lt;BR /&gt;BEGIN-&amp;gt;JOB1-&amp;gt;JOB2-&amp;gt;END
&lt;BR /&gt;Below is a DEPTJOB
&lt;BR /&gt;TABLE1-&amp;gt;TMAP-&amp;gt;TABLE1_DM
&lt;BR /&gt;if there are no records in DEPT then I want to exit and run only JOB2</description>
      <pubDate>Sun, 29 Jul 2012 20:55:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/count-records/m-p/2201174#M3365</guid>
      <dc:creator>_AnonymousUser</dc:creator>
      <dc:date>2012-07-29T20:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: count records</title>
      <link>https://community.qlik.com/t5/Talend-Studio/count-records/m-p/2201175#M3366</link>
      <description>You would have to read the number of rows using t&amp;lt;DB&amp;gt;Input (SELECT COUNT(*) FROM DEPT) passing the result to, say, tSetGlobalVar and then have an If trigger from t&amp;lt;DB&amp;gt;Input where you can test the globalMap variable created to see if it's &amp;gt;0 and so trigger JOB1.</description>
      <pubDate>Mon, 30 Jul 2012 01:20:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/count-records/m-p/2201175#M3366</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2012-07-30T01:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: count records</title>
      <link>https://community.qlik.com/t5/Talend-Studio/count-records/m-p/2201176#M3367</link>
      <description>I have 5 seaparate jobs that needs this count(*) check. Is there a way I can create one job that would take table name as input and return me record count ...instead of doing the same thing in each job.
&lt;BR /&gt;select count(*) from &amp;amp;variablename -&amp;gt; tsetGlobalvar</description>
      <pubDate>Mon, 30 Jul 2012 02:37:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/count-records/m-p/2201176#M3367</guid>
      <dc:creator>_AnonymousUser</dc:creator>
      <dc:date>2012-07-30T02:37:54Z</dc:date>
    </item>
    <item>
      <title>Re: count records</title>
      <link>https://community.qlik.com/t5/Talend-Studio/count-records/m-p/2201177#M3368</link>
      <description>Sure.  Put that part into a job or joblet using a context variable for the table name.</description>
      <pubDate>Mon, 30 Jul 2012 02:39:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/count-records/m-p/2201177#M3368</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2012-07-30T02:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: count records</title>
      <link>https://community.qlik.com/t5/Talend-Studio/count-records/m-p/2201178#M3369</link>
      <description>I created joblet like 
&lt;BR /&gt;INPUT -&amp;gt; toracleinput-&amp;gt;tsetglobavar-&amp;gt;output 
&lt;BR /&gt;toracleinput - I gave query like this select count(*) as numofrecords from context.tablename 
&lt;BR /&gt;tsetglobavar - key numofrecords values row1.numofrecords 
&lt;BR /&gt; 
&lt;BR /&gt;INSIDE JOB1 
&lt;BR /&gt;JOBLET -&amp;gt;run if -&amp;gt;TABLE1-&amp;gt;TMAP-&amp;gt;TABLE1_DM 
&lt;BR /&gt;where to provide the value for context.tablename 
&lt;BR /&gt;I am really not clear... can anyone provide a sample flow</description>
      <pubDate>Tue, 31 Jul 2012 01:11:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/count-records/m-p/2201178#M3369</guid>
      <dc:creator>_AnonymousUser</dc:creator>
      <dc:date>2012-07-31T01:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: count records</title>
      <link>https://community.qlik.com/t5/Talend-Studio/count-records/m-p/2201179#M3370</link>
      <description>Just define it as the default value for the context variable in your job...</description>
      <pubDate>Tue, 31 Jul 2012 02:02:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/count-records/m-p/2201179#M3370</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2012-07-31T02:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: count records</title>
      <link>https://community.qlik.com/t5/Talend-Studio/count-records/m-p/2201180#M3371</link>
      <description>context variable is read only inside the job where I dropped the joblet. Unable to reuse the joblet&lt;BR /&gt;joblet -runif records &amp;gt;1 -toracleinput -&amp;gt; tmap -toraclebulkoutputexec&lt;BR /&gt; Any ideas  how  to do this?   I need to basically reuse the query &lt;BR /&gt;"select count(*) from "+  context.table_name</description>
      <pubDate>Tue, 31 Jul 2012 21:02:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/count-records/m-p/2201180#M3371</guid>
      <dc:creator>_AnonymousUser</dc:creator>
      <dc:date>2012-07-31T21:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: count records</title>
      <link>https://community.qlik.com/t5/Talend-Studio/count-records/m-p/2201181#M3372</link>
      <description>Each job that uses the joblet needs to have the context variable defined with the relevant table name as its value.  I don't understand why you think it can't be re-used.</description>
      <pubDate>Wed, 01 Aug 2012 00:23:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/count-records/m-p/2201181#M3372</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2012-08-01T00:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: count records</title>
      <link>https://community.qlik.com/t5/Talend-Studio/count-records/m-p/2201182#M3373</link>
      <description>thanks, I got the joblet working along with context .
&lt;BR /&gt;
&lt;BR /&gt;Inside the job I have
&lt;BR /&gt;joblet -&amp;gt; output_1 -&amp;gt; tjavarow - if numRecordCount&amp;gt;0 -&amp;gt; tjava
&lt;BR /&gt; - if numRecordCount==0-&amp;gt;-&amp;gt; tjava
&lt;BR /&gt;
&lt;BR /&gt;tjavarow
&lt;BR /&gt;output_row.numRecordCount = input_row.numRecordCount;
&lt;BR /&gt;run if has errors not sure how to provide the condition inside run if. appreciate ur help
&lt;BR /&gt;Is there a way I can get run if directly from joblet?</description>
      <pubDate>Wed, 01 Aug 2012 22:41:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/count-records/m-p/2201182#M3373</guid>
      <dc:creator>_AnonymousUser</dc:creator>
      <dc:date>2012-08-01T22:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: count records</title>
      <link>https://community.qlik.com/t5/Talend-Studio/count-records/m-p/2201183#M3374</link>
      <description>Unfortunately, joblets do not yet support RunIf triggers directly so I would design it as follows:
&lt;BR /&gt;joblet:
&lt;BR /&gt;toracleinput -main-&amp;gt; tsetglobavar -if (Integer)globalMap.get("numrecordcount")&amp;gt;0-&amp;gt; tjava -onsubjobok-&amp;gt; trigger_output_1
&lt;BR /&gt; -if (Integer)globalMap.get("numrecordcount")==0-&amp;gt; tjava -onsubjobok-&amp;gt; trigger_output_2
&lt;BR /&gt;Note that the tjavas are empty; they are just place-holders for the if triggers.
&lt;BR /&gt;job:
&lt;BR /&gt;joblet -onsubjobok1-&amp;gt; tjava
&lt;BR /&gt; -onsubjobok2-&amp;gt; tjava
&lt;BR /&gt;The problem with your approach is that the if is referencing a variable "numRecordCount" that doesn't exist, you would have to use &amp;lt;rowname&amp;gt;.numRecordCount (the rowname being that from the joblet). There is also no need to define output_row.numRecordCount in tjavarow unless there is a flow from tjavarow.</description>
      <pubDate>Thu, 02 Aug 2012 00:02:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/count-records/m-p/2201183#M3374</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2012-08-02T00:02:24Z</dc:date>
    </item>
  </channel>
</rss>

