<?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: calcul the sum in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277236#M53071</link>
    <description>Could you please post a screen shot of your job. Looks like you try to use the sum before it is calculated.&lt;BR /&gt;Bye&lt;BR /&gt;Volker</description>
    <pubDate>Thu, 26 Feb 2009 06:12:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-02-26T06:12:24Z</dc:date>
    <item>
      <title>calcul the sum</title>
      <link>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277228#M53063</link>
      <description>hello;
&lt;BR /&gt;i have more than tow tables in a data base (Access). it have the same structure.
&lt;BR /&gt;I would like calculate the sum total of a columun ("net" for example) for all tables and put the result in a variable.
&lt;BR /&gt;Can you please help me</description>
      <pubDate>Sat, 16 Nov 2024 14:04:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277228#M53063</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T14:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: calcul the sum</title>
      <link>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277229#M53064</link>
      <description>Hi,&lt;BR /&gt;you could connect different inputs with same structure with tUnite. Than you could use tAggregateRow to calculate the sum.&lt;BR /&gt;I think something like the following should work too:&lt;BR /&gt;SELECT sum(net) FROM (SELECT net FROM tab A UNION SELECT net FROM tab b)&lt;BR /&gt;Bye&lt;BR /&gt;Volker</description>
      <pubDate>Fri, 20 Feb 2009 21:14:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277229#M53064</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-02-20T21:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: calcul the sum</title>
      <link>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277230#M53065</link>
      <description>hi Volker;&lt;BR /&gt;i think i can't use tUnit because in reality i used tFlowToIterate to iterate my tables.&lt;BR /&gt;So what how can you advice me.&lt;BR /&gt;Thank you for your help.</description>
      <pubDate>Sat, 21 Feb 2009 12:50:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277230#M53065</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-02-21T12:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: calcul the sum</title>
      <link>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277231#M53066</link>
      <description>Hi,&lt;BR /&gt;OK, it is not as easy as i thought &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;You could use a temporary file (with append) and than calculate the sum.&lt;BR /&gt;Or you could use a context variable and calculate the value in a tJavaRow (context.sum+= actualValue)&lt;BR /&gt;Bye&lt;BR /&gt;Volker</description>
      <pubDate>Sat, 21 Feb 2009 20:36:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277231#M53066</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-02-21T20:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: calcul the sum</title>
      <link>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277232#M53067</link>
      <description>hi volker;&lt;BR /&gt;i don't know how to use exactely a context variable.&lt;BR /&gt;can you please give me an exemple.&lt;BR /&gt;thank you.</description>
      <pubDate>Mon, 23 Feb 2009 07:52:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277232#M53067</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-02-23T07:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: calcul the sum</title>
      <link>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277233#M53068</link>
      <description>Hi,
&lt;BR /&gt;go to the context tab and add a line. Name it "sum" (for example).
&lt;BR /&gt;Add a tJavaRow in your flow and copy each input line to the output:
&lt;BR /&gt;
&lt;PRE&gt;output_row.varName= input_row.varName;&lt;/PRE&gt;
&lt;BR /&gt;(with TOS 3.0.x press "Add code")
&lt;BR /&gt;The last line should be:
&lt;BR /&gt;
&lt;PRE&gt;context.sum+= input_row.varNameForSum&lt;/PRE&gt;
&lt;BR /&gt;Add after your process one additional tJava with the following code:
&lt;BR /&gt;
&lt;PRE&gt;System.out.println("The sum is: " + context.sum.toString());&lt;/PRE&gt;
&lt;BR /&gt;Bye
&lt;BR /&gt;Volker</description>
      <pubDate>Mon, 23 Feb 2009 20:43:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277233#M53068</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-02-23T20:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: calcul the sum</title>
      <link>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277234#M53069</link>
      <description>hello Volker,
&lt;BR /&gt;Thank you for your anser.Unfortunnatly it doesn't work.
&lt;BR /&gt;I can't calculate the total sum
&lt;BR /&gt;after running job i get this message:" The sum is " whitout the result
&lt;BR /&gt;Can you help me please.</description>
      <pubDate>Tue, 24 Feb 2009 09:29:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277234#M53069</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-02-24T09:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: calcul the sum</title>
      <link>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277235#M53070</link>
      <description>hi Volker;&lt;BR /&gt;i have yhis message exception when i execute my job:&lt;BR /&gt;&lt;BR /&gt;Exception in component tJava_1&lt;BR /&gt;java.lang.NullPointerException&lt;BR /&gt;	at jhgf.cc_0_1.cc.tAccessInput_1Process(cc.java:1045)&lt;BR /&gt;	at jhgf.cc_0_1.cc.runJobInTOS(cc.java:1446)&lt;BR /&gt;	at jhgf.cc_0_1.cc.main(cc.java:1355)&lt;BR /&gt;please can you help me</description>
      <pubDate>Tue, 24 Feb 2009 14:35:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277235#M53070</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-02-24T14:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: calcul the sum</title>
      <link>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277236#M53071</link>
      <description>Could you please post a screen shot of your job. Looks like you try to use the sum before it is calculated.&lt;BR /&gt;Bye&lt;BR /&gt;Volker</description>
      <pubDate>Thu, 26 Feb 2009 06:12:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277236#M53071</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-02-26T06:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: calcul the sum</title>
      <link>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277237#M53072</link>
      <description>hi Volker;&lt;BR /&gt;this is my job in 4 slots:&lt;BR /&gt;Thank you.</description>
      <pubDate>Thu, 26 Feb 2009 08:28:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277237#M53072</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-02-26T08:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: calcul the sum</title>
      <link>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277238#M53073</link>
      <description>Hi,
&lt;BR /&gt;looks like the tJava is executed before the tJavaRow. To get the sum at all add remove tJava from your stream and add it with an OnSubjobOk. This should work.
&lt;BR /&gt;Bye
&lt;BR /&gt;Volker</description>
      <pubDate>Thu, 26 Feb 2009 20:05:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277238#M53073</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-02-26T20:05:07Z</dc:date>
    </item>
    <item>
      <title>Re: calcul the sum</title>
      <link>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277239#M53074</link>
      <description>Hi Volker;&lt;BR /&gt;thank you for your help.I tr it but it dosn't work.&lt;BR /&gt;Could you please post a screen shot .&lt;BR /&gt;Thank you</description>
      <pubDate>Fri, 27 Feb 2009 10:04:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277239#M53074</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-02-27T10:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: calcul the sum</title>
      <link>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277240#M53075</link>
      <description>Hi,
&lt;BR /&gt;sorry for the late post. Last week half of my family was down with the flu.
&lt;BR /&gt;
&lt;BR /&gt;So first I think I get the reason for the problem. I run into the self error at creating an example. It seems that you must define a initial value for your context variable. Talend is using Double and not the native type double. So the += operator throws a NullPointerException. 
&lt;BR /&gt;Anyway here is my solution:
&lt;BR /&gt;Code in tJavaRow
&lt;BR /&gt;
&lt;PRE&gt;output_row.orderId = input_row.orderId;&lt;BR /&gt;output_row.orderText = input_row.orderText;&lt;BR /&gt;context.sum+= input_row.orderId;&lt;/PRE&gt;
&lt;BR /&gt;Code in tJava
&lt;BR /&gt;
&lt;PRE&gt;System.out.println("The sum of all order ids is: " + context.sum);&lt;/PRE&gt;
&lt;BR /&gt;And the output of the job:
&lt;BR /&gt;
&lt;PRE&gt;1|Mr. Jones first order&lt;BR /&gt;2|Mr. Jones second order&lt;BR /&gt;3|The third order of Mr. Jones&lt;BR /&gt;6|Mrs. Tompson first ordr&lt;BR /&gt;7|Mrs. Tompson second order&lt;BR /&gt;8|Mrs. Tompson order number third&lt;BR /&gt;18|Mrs. Jones only one order&lt;BR /&gt;19|Mr. Albert only one order&lt;BR /&gt;20|Mrs. Albert first order&lt;BR /&gt;21|Mrs. Albert second order&lt;BR /&gt;22|Mrs. Albert third order&lt;BR /&gt;The sum of all order ids is: 127.0&lt;/PRE&gt;
&lt;BR /&gt;The jobs selects for some customer orders from a database and calculates the sum of the customerId.
&lt;BR /&gt;Bye
&lt;BR /&gt;Volker</description>
      <pubDate>Tue, 03 Mar 2009 21:51:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277240#M53075</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-03-03T21:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: calcul the sum</title>
      <link>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277241#M53076</link>
      <description>Hi Volker;&lt;BR /&gt;Sorry for my late. I have a problem in my Internet Connexion.&lt;BR /&gt;I hope in good health and your family too.&lt;BR /&gt;Thank you for your anser.It was a good solution.&lt;BR /&gt;Problem resolved. &lt;BR /&gt;Thank you</description>
      <pubDate>Fri, 13 Mar 2009 08:20:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277241#M53076</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-03-13T08:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: calcul the sum</title>
      <link>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277242#M53077</link>
      <description>Thanks. This helped me also.</description>
      <pubDate>Tue, 30 Mar 2010 00:35:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/calcul-the-sum/m-p/2277242#M53077</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-03-30T00:35:31Z</dc:date>
    </item>
  </channel>
</rss>

