<?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: Doing a calculation in the load script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Doing-a-calculation-in-the-load-script/m-p/1696090#M725367</link>
    <description>&lt;P&gt;Oh wow, that simple? I can't believe it&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;.&lt;/P&gt;&lt;P&gt;I just tried it and it worked a charm. Thank you so much. I wish I asked sooner, but the day or two struggling through it, had me learning a few things I haven't known before.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, a kind thank you for your quick and excellent response.&lt;/P&gt;&lt;P&gt;Take care,&lt;/P&gt;&lt;P&gt;Jacques&lt;/P&gt;</description>
    <pubDate>Thu, 23 Apr 2020 11:24:17 GMT</pubDate>
    <dc:creator>jacqueshol</dc:creator>
    <dc:date>2020-04-23T11:24:17Z</dc:date>
    <item>
      <title>Doing a calculation in the load script</title>
      <link>https://community.qlik.com/t5/QlikView/Doing-a-calculation-in-the-load-script/m-p/1696069#M725365</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I receive the following data via an API from Smartsheet as follows:&lt;/P&gt;&lt;P&gt;SET ThousandSep=',';&lt;BR /&gt;SET DecimalSep='.';&lt;BR /&gt;SET MoneyThousandSep='&amp;nbsp;';&lt;BR /&gt;SET MoneyDecimalSep=',';&lt;BR /&gt;SET MoneyFormat='R#&amp;nbsp;##0,00;-R#&amp;nbsp;##0,00';&lt;BR /&gt;SET TimeFormat='hh:mm:ss';&lt;BR /&gt;SET DateFormat='DD-MM-YY';&lt;BR /&gt;SET TimestampFormat='DD-MM-YY hh:mm:ss[.fff]';&lt;BR /&gt;SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';&lt;BR /&gt;SET DayNames='Sun;Mon;Tue;Wed;Thu;Fri;Sat';&lt;/P&gt;&lt;P&gt;ODBC CONNECT TO [My Smartsheet] (XUserId is eRQXFVFM████████████, XPassword is ███████████);&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt;[Operation],&lt;BR /&gt;[Truck],&lt;BR /&gt;[Date],&lt;BR /&gt;[Shift],&lt;BR /&gt;[Status],&lt;BR /&gt;[Comments],&lt;BR /&gt;[Operator],&lt;BR /&gt;[Opening Kms],&lt;BR /&gt;[Closing Kms],&lt;BR /&gt;[Kms],&lt;BR /&gt;[Location 1],&lt;BR /&gt;[Loc 1 Loads],&lt;BR /&gt;[Loc 1 Tons],&lt;BR /&gt;[Location 2],&lt;BR /&gt;[Loc 2 Loads],&lt;BR /&gt;[Loc 2 Tons],&lt;BR /&gt;[Location 3],&lt;BR /&gt;[Loc 3 Loads],&lt;BR /&gt;[Loc 3 Tons],&lt;BR /&gt;&lt;FONT color="#99CC00"&gt;&lt;STRONG&gt;//sum([Loc 1 Loads]) + sum([Loc 2 Loads]) + sum([Loc 3 Loads]) as [Total Loads],&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;[Time Out],&lt;BR /&gt;[Time Back];&lt;/P&gt;&lt;P&gt;SQL SELECT *&lt;BR /&gt;FROM "Daily Ops Report (VR) - Grid__5422264863745924s_(Phakamisa/Daily Ops Report for Vaal River)";&lt;/P&gt;&lt;P&gt;My script above runs 100% and I am able to import data just fine into my model. I, however, have to often work with the Total Loads which is a sum of [Loc 1 Loads] and [Loc 2 Loads] and [Loc 3 Loads]. Creating a new field in the script that sums this, would be great and save considerable time.&lt;/P&gt;&lt;P&gt;I tried adding a calculation in the SQL portion of the script, but that didn’t work. After reading a few posts on the forum, I added a LOAD section and added the calculation in there &lt;STRONG&gt;&lt;FONT color="#99CC00"&gt;(green line in the script)&lt;/FONT&gt;&lt;/STRONG&gt;. This unfortuanately doesn’t work and I get an error message (see attached screenshot):&lt;/P&gt;&lt;P&gt;ODBC read failed&lt;/P&gt;&lt;P&gt;SQL SELECT *&lt;/P&gt;&lt;P&gt;FROM “Daily Ops Report (VR) - Grid__5422264863745924s_(Phakamisa/Daily Ops Report for Vaal River)";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I change the calculation line to:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#99CC00"&gt;&lt;STRONG&gt;&amp;nbsp;[Loc 1 Loads] + [Loc 2 Loads] + [Loc 3 Loads] as [Total Loads],&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;the script runs fine without error, but [Total Loads] tallies to 0 when that is clearly not the correct answer.&lt;/P&gt;&lt;P&gt;I have searched comprehensively, but can’t figure out what I need to do. Can anyone assist please? Any help will be greatly appreciated.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jacques&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 18:44:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Doing-a-calculation-in-the-load-script/m-p/1696069#M725365</guid>
      <dc:creator>jacqueshol</dc:creator>
      <dc:date>2024-11-16T18:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: Doing a calculation in the load script</title>
      <link>https://community.qlik.com/t5/QlikView/Doing-a-calculation-in-the-load-script/m-p/1696075#M725366</link>
      <description>&lt;P&gt;Hi, using +, if any of the fields is Null() the result will be Null().&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try with RangeSum: RangeSum([Loc 1 Loads],[Loc 2 Loads],[Loc 3 Loads]) as [Total Loads].&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF9900"&gt;1 + Null() = &lt;STRONG&gt;Null()&lt;/STRONG&gt;&lt;/FONT&gt; ; &lt;FONT color="#339966"&gt;RangeSum(1, Null())=&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2020 10:55:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Doing-a-calculation-in-the-load-script/m-p/1696075#M725366</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2020-04-23T10:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: Doing a calculation in the load script</title>
      <link>https://community.qlik.com/t5/QlikView/Doing-a-calculation-in-the-load-script/m-p/1696090#M725367</link>
      <description>&lt;P&gt;Oh wow, that simple? I can't believe it&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;.&lt;/P&gt;&lt;P&gt;I just tried it and it worked a charm. Thank you so much. I wish I asked sooner, but the day or two struggling through it, had me learning a few things I haven't known before.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, a kind thank you for your quick and excellent response.&lt;/P&gt;&lt;P&gt;Take care,&lt;/P&gt;&lt;P&gt;Jacques&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2020 11:24:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Doing-a-calculation-in-the-load-script/m-p/1696090#M725367</guid>
      <dc:creator>jacqueshol</dc:creator>
      <dc:date>2020-04-23T11:24:17Z</dc:date>
    </item>
  </channel>
</rss>

