<?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: load expression in script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/load-expression-in-script/m-p/350953#M495201</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay so to solve this you need to use the timestamp function as well as the interval function:&lt;/P&gt;&lt;P&gt;Since I don't have your actual data I made an inline table.&lt;/P&gt;&lt;P&gt;The script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;test:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;CUSTOMERNBR, ARTNBR, YEAR, SALES, DATETIME1, DATETIME2&lt;/P&gt;&lt;P&gt;5436698, 3154, 2011, 317000, 01-01-2012 08:00, 01-01-2012 02:00&lt;/P&gt;&lt;P&gt;5436698, 3154, 2010, 325000, 01-02-2011 07:00, 01-01-2011 07:00&lt;/P&gt;&lt;P&gt;5436698, 3169, 2011, 100000, 03-01-2010 02:00, 02-01-2010 02:00&lt;/P&gt;&lt;P&gt;5436698, 3169, 2010, 150000, 02-01-2013 10:00, 01-01-2013 10:00&lt;/P&gt;&lt;P&gt;]&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;test2:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;timestamp#(DATETIME1,'MM-DD-YYYY hh:mm') as DATETIME_A,&lt;/P&gt;&lt;P&gt;timestamp#(DATETIME2,'MM-DD-YYYY hh:mm') as DATETIME_B,&lt;/P&gt;&lt;P&gt;'' as Junk&lt;/P&gt;&lt;P&gt;Resident test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;drop table test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;test3:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;DATETIME_A - DATETIME_B as Duration,&lt;/P&gt;&lt;P&gt;' ' as Junk2&lt;/P&gt;&lt;P&gt;Resident test2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;drop table test2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;test4:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;interval(Duration, 'MM-DD-YYYY hh.mm') as Difference,&lt;/P&gt;&lt;P&gt;' ' as Junk3&lt;/P&gt;&lt;P&gt;Resident test3;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop table test3;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am subtracting DATETIME1-DATETIME2 for your results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also change the format of the difference by changing the MM-DD-YYYY hh.mm part.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also attached a QV file let me know if you need any other help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Mar 2012 19:00:14 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-03-13T19:00:14Z</dc:date>
    <item>
      <title>load expression in script</title>
      <link>https://community.qlik.com/t5/QlikView/load-expression-in-script/m-p/350952#M495200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i've a problem. In my board i have two fields, booth are date/time field like 01-01-2012 08:00 fits date/time is the startdate and the other the finishdate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In some tables i used the expression finishdate - startdate to calculate the duration, no problem with that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But nw i want this expression to be loaded in the script, so that a new field ak duration ia avalable. When this new field is avalable i can make a statistic object&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;, which displays the maximum/mimimus/averige duration. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone suggestions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;grzt Ed&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 17:39:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/load-expression-in-script/m-p/350952#M495200</guid>
      <dc:creator />
      <dc:date>2012-03-13T17:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: load expression in script</title>
      <link>https://community.qlik.com/t5/QlikView/load-expression-in-script/m-p/350953#M495201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay so to solve this you need to use the timestamp function as well as the interval function:&lt;/P&gt;&lt;P&gt;Since I don't have your actual data I made an inline table.&lt;/P&gt;&lt;P&gt;The script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;test:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;CUSTOMERNBR, ARTNBR, YEAR, SALES, DATETIME1, DATETIME2&lt;/P&gt;&lt;P&gt;5436698, 3154, 2011, 317000, 01-01-2012 08:00, 01-01-2012 02:00&lt;/P&gt;&lt;P&gt;5436698, 3154, 2010, 325000, 01-02-2011 07:00, 01-01-2011 07:00&lt;/P&gt;&lt;P&gt;5436698, 3169, 2011, 100000, 03-01-2010 02:00, 02-01-2010 02:00&lt;/P&gt;&lt;P&gt;5436698, 3169, 2010, 150000, 02-01-2013 10:00, 01-01-2013 10:00&lt;/P&gt;&lt;P&gt;]&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;test2:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;timestamp#(DATETIME1,'MM-DD-YYYY hh:mm') as DATETIME_A,&lt;/P&gt;&lt;P&gt;timestamp#(DATETIME2,'MM-DD-YYYY hh:mm') as DATETIME_B,&lt;/P&gt;&lt;P&gt;'' as Junk&lt;/P&gt;&lt;P&gt;Resident test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;drop table test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;test3:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;DATETIME_A - DATETIME_B as Duration,&lt;/P&gt;&lt;P&gt;' ' as Junk2&lt;/P&gt;&lt;P&gt;Resident test2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;drop table test2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;test4:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;interval(Duration, 'MM-DD-YYYY hh.mm') as Difference,&lt;/P&gt;&lt;P&gt;' ' as Junk3&lt;/P&gt;&lt;P&gt;Resident test3;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop table test3;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am subtracting DATETIME1-DATETIME2 for your results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also change the format of the difference by changing the MM-DD-YYYY hh.mm part.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also attached a QV file let me know if you need any other help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 19:00:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/load-expression-in-script/m-p/350953#M495201</guid>
      <dc:creator />
      <dc:date>2012-03-13T19:00:14Z</dc:date>
    </item>
  </channel>
</rss>

