<?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 How can I solve this? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-can-I-solve-this/m-p/321271#M708808</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello and thanks for your response,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried the code but it is not working (even without the time calculation).&lt;/P&gt;&lt;P&gt;If I understood it right, peek is only checking the previous record. But in my case I have to iterate through all transactions to find out if there is somewhere a 'true' transaction at the right time with the right person and cashier.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These last days I tried to do this using macros.&lt;/P&gt;&lt;P&gt;Sadly I can't find a documentation for available functions other than the automation reference which doesn't say much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Trying to fight my way through vbscript, some questions popped out:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Is there a way to make a SELECT with the DynamicUpdateCommand ? at least to see if it found something.&lt;/P&gt;&lt;P&gt;I tried to put the select statement into an exists(), but the DynamicUpdateCommand has something against that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Can I iterate somehow through the table without using .select and .GetPossibleValues to move through the columns as these are pretty time consuming?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 Sep 2011 21:02:47 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-09-07T21:02:47Z</dc:date>
    <item>
      <title>How can I solve this?</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-solve-this/m-p/321269#M708806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Qlik Community!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to do something but I don't know how to realize it. Although I might have a solution for it, I don't really think it's the right one ...&lt;/P&gt;&lt;P&gt;So here it goes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a transaction log with the following fields:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TransactionID, Person, Cashier, Time, Flag&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Flag can be either true or false.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I want to do is to add an column to this Table named "status"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A transaction with the flag 'true' will get in the status field '1'&lt;/P&gt;&lt;P&gt;A transaction with the flag 'false' will get '0' IF there is a transaction with a 'true' flag following it within 30 minutes&lt;STRONG&gt; (for the same cashier and person)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;and '-1' if there isn't such a transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this could be done pretty straightforward using a couple of for loops, but I don't know how, or if it is possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I have tried so far is to find out how to calculate the status.&lt;/P&gt;&lt;P&gt;I filtered out all transactions with a 'false' flag and added them a column with their timestamp + 1/2 hour. (it took me a while to find out how to manipulate a timestamp -_-)&lt;/P&gt;&lt;P&gt;Finally i joined them on an intervalmatch with all the 'true' transactions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[zeros]: &lt;/P&gt;&lt;P&gt; LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; person,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cashier,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; time&lt;/P&gt;&lt;P&gt; Resident [log]&lt;/P&gt;&lt;P&gt; Where flag = 'true';&lt;/P&gt;&lt;P&gt; Left join intervalMatch(Time) &lt;/P&gt;&lt;P&gt; Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; transactionID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; person,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cashier,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; time as timeStart,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Timestamp(time + 30/(24*60), 'DD-MM-YYYY hh:mm:ss') as timeEnd&lt;/P&gt;&lt;P&gt; Resident [log]&lt;/P&gt;&lt;P&gt; Where flag = 'false'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is not really working as it joins me every 'true' of 'false' transaction with the following 'true' transaction (with the same person and casheer)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This redundacy is not acceptable as the log table is huge.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After getting this far I asked myself if it could be done without creating other redundant tables for it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So how would you do it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!!1&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Sep 2011 19:41:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-solve-this/m-p/321269#M708806</guid>
      <dc:creator />
      <dc:date>2011-09-02T19:41:58Z</dc:date>
    </item>
    <item>
      <title>How can I solve this?</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-solve-this/m-p/321270#M708807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you can solve this using only one load statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load TransactionID, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Person, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Cashier, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Time, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Flag,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(Flag='true',1, if(peek('TransactionID')=TransactionID and peek('Person')=Person and peek('Cashier')=Cashier and peek('Flag')='false' and [peek('Time')-Time&amp;lt; 30min], 0, -1) as Status&lt;/P&gt;&lt;P&gt;from x&lt;/P&gt;&lt;P&gt;order by TransactionID, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Person, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Cashier, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Time;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please note that the if statement I created is just a sample and you must adjust it. The time difference check is just conceptual, you must code it correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this points you in the right direction.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Fernando&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 18:18:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-solve-this/m-p/321270#M708807</guid>
      <dc:creator>fosuzuki</dc:creator>
      <dc:date>2011-09-07T18:18:10Z</dc:date>
    </item>
    <item>
      <title>How can I solve this?</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-solve-this/m-p/321271#M708808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello and thanks for your response,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried the code but it is not working (even without the time calculation).&lt;/P&gt;&lt;P&gt;If I understood it right, peek is only checking the previous record. But in my case I have to iterate through all transactions to find out if there is somewhere a 'true' transaction at the right time with the right person and cashier.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These last days I tried to do this using macros.&lt;/P&gt;&lt;P&gt;Sadly I can't find a documentation for available functions other than the automation reference which doesn't say much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Trying to fight my way through vbscript, some questions popped out:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Is there a way to make a SELECT with the DynamicUpdateCommand ? at least to see if it found something.&lt;/P&gt;&lt;P&gt;I tried to put the select statement into an exists(), but the DynamicUpdateCommand has something against that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Can I iterate somehow through the table without using .select and .GetPossibleValues to move through the columns as these are pretty time consuming?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 21:02:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-solve-this/m-p/321271#M708808</guid>
      <dc:creator />
      <dc:date>2011-09-07T21:02:47Z</dc:date>
    </item>
    <item>
      <title>How can I solve this?</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-solve-this/m-p/321272#M708809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can u send a xls sheet with some sample data? I think this should be very easy to solve in the script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should always avoid using macros since they are a lot more time consuming. And if you have a time consuming calculation, try to always precalculate them in the script, so that users can have a nice experience.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Fernando&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Sep 2011 13:48:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-solve-this/m-p/321272#M708809</guid>
      <dc:creator>fosuzuki</dc:creator>
      <dc:date>2011-09-08T13:48:24Z</dc:date>
    </item>
    <item>
      <title>How can I solve this?</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-solve-this/m-p/321273#M708810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes that's true, I noticed how much it got slowed down by the macros!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help but it the precalculation by using the script won't be necessary anymore.&lt;/P&gt;&lt;P&gt;You were right about the precalculation so I took it even further and precalculated the whole table in sql before loading it into qlikview!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Sep 2011 20:19:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-solve-this/m-p/321273#M708810</guid>
      <dc:creator />
      <dc:date>2011-09-08T20:19:55Z</dc:date>
    </item>
  </channel>
</rss>

