<?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: Iterate through hours between timestamps in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Iterate-through-hours-between-timestamps/m-p/2498985#M102936</link>
    <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/287708"&gt;@Clement15&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This worked as well. I like the Intervalmatch and autogenerate of the hourly data in it's own table&lt;/P&gt;</description>
    <pubDate>Fri, 20 Dec 2024 17:25:49 GMT</pubDate>
    <dc:creator>covenant_bi</dc:creator>
    <dc:date>2024-12-20T17:25:49Z</dc:date>
    <item>
      <title>Iterate through hours between timestamps</title>
      <link>https://community.qlik.com/t5/App-Development/Iterate-through-hours-between-timestamps/m-p/2498844#M102927</link>
      <description>&lt;P&gt;Hello, we are wanting to iterate through hours between timestamps.&amp;nbsp; We want ultimately want to bucket our IDs by hours of the day and a department.&amp;nbsp; We are familiar with this technique using dates&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/qlikview/May2024/Subsystems/Client/Content/QV_QlikView/Scripting/CounterFunctions/IterNo.htm" target="_blank"&gt;IterNo - script function | QlikView Help&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;But we want to take it step further and iterate through the hours of the day from the start time to the end time of each department the ID appears in.&amp;nbsp; In the attached Excel, I have the source data as we have it and then how we want it to appear.&lt;/P&gt;
&lt;P&gt;We are trying to something like the IterNo technique above but it's not quite working out.&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Data:
LOAD *
    ,IterNo() as Count
    ,Timestamp(MinDate+(1/24))+IterNo()-1 as Hourly
    Resident TempHourly
    While MinDate+(1/24) + IterNo() -1 &amp;lt;=MaxDate
    ;
    
    Drop Table TempHourly;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 20:18:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Iterate-through-hours-between-timestamps/m-p/2498844#M102927</guid>
      <dc:creator>covenant_bi</dc:creator>
      <dc:date>2024-12-19T20:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate through hours between timestamps</title>
      <link>https://community.qlik.com/t5/App-Development/Iterate-through-hours-between-timestamps/m-p/2498958#M102931</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Here it is, it should work. Sorry for the floor() and the weird additions but the rounding of hours works weirdly, but like this, all the hours are taken.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;TempHourly:&lt;BR /&gt;&lt;BR /&gt;LOAD&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ID,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; DEPARTMENT,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; "timestamp(MinDate)" as [timestamp(MinDate)],&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; "timestamp(MaxDate)" as [timestamp(MaxDate)]&lt;BR /&gt;&lt;BR /&gt;FROM [lib://DataFiles/sample data (1).xlsx]&lt;BR /&gt;&lt;BR /&gt;(ooxml, embedded labels, table is Sheet1)&lt;BR /&gt;&lt;BR /&gt;where ID &amp;lt;&amp;gt; null();&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;MinMaxDates:&lt;BR /&gt;&lt;BR /&gt;LOAD&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; num(Min([timestamp(MinDate)])) as MinDateTime,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; num(Max([timestamp(MaxDate)])) as MaxDateTime&lt;BR /&gt;&lt;BR /&gt;RESIDENT TempHourly;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;// Stocker les dates minimales et maximales dans des variables&lt;BR /&gt;&lt;BR /&gt;LET vMinDateTime = Peek('MinDateTime', 0, 'MinMaxDates');&lt;BR /&gt;&lt;BR /&gt;LET vMaxDateTime = Peek('MaxDateTime', 0, 'MinMaxDates');&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;// Créer une table temporaire pour les heures&lt;BR /&gt;&lt;BR /&gt;TempHours:&lt;BR /&gt;&lt;BR /&gt;LOAD&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; floor(num('$(vMinDateTime)' + (IterNo()-1)/24)+ 0.000001,1.0/24.0)-0.00000000001 AS NumHour&lt;BR /&gt;&lt;BR /&gt;AUTOGENERATE 1&lt;BR /&gt;&lt;BR /&gt;WHILE '$(vMinDateTime)' + (IterNo()-2)/24 &amp;lt;= '$(vMaxDateTime)';&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;NoConcatenate&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;// Charger la table finale des heures&lt;BR /&gt;&lt;BR /&gt;Heures:&lt;BR /&gt;&lt;BR /&gt;LOAD&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; NumHour,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Timestamp(NumHour, 'DD/MM/YYYY hh:mm') as Hour&lt;BR /&gt;&lt;BR /&gt;RESIDENT TempHours;&lt;BR /&gt;&lt;BR /&gt;Drop table TempHours;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;inner Join(TempHourly)&lt;BR /&gt;&lt;BR /&gt;TEST2:&lt;BR /&gt;&lt;BR /&gt;IntervalMatch(Hour)&lt;BR /&gt;&lt;BR /&gt;Load&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; [timestamp(MinDate)],&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; [timestamp(MaxDate)]&lt;BR /&gt;&lt;BR /&gt;Resident TempHourly;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 14:36:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Iterate-through-hours-between-timestamps/m-p/2498958#M102931</guid>
      <dc:creator>Clement15</dc:creator>
      <dc:date>2024-12-20T14:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate through hours between timestamps</title>
      <link>https://community.qlik.com/t5/App-Development/Iterate-through-hours-between-timestamps/m-p/2498981#M102934</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/38766"&gt;@covenant_bi&lt;/a&gt;&amp;nbsp; If your Dates are in proper timestamp format, you can simply try below. If not, before taking resident convert date into proper timestamp for using&amp;nbsp;&lt;STRONG&gt;Timestamp#(&lt;/STRONG&gt;)&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Load *,
     timestamp(MinDate + (IterNo()-1)/24) as Time_Hourly
Resident TempHourly
While MinDate + (IterNo()-1)/24&amp;lt;=MaxDate;

drop table TempHourly;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-12-20 at 16.44.19.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/175957i679196B309F9D16D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-12-20 at 16.44.19.png" alt="Screenshot 2024-12-20 at 16.44.19.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 16:44:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Iterate-through-hours-between-timestamps/m-p/2498981#M102934</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-12-20T16:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate through hours between timestamps</title>
      <link>https://community.qlik.com/t5/App-Development/Iterate-through-hours-between-timestamps/m-p/2498984#M102935</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/336"&gt;@Kushal_Chawda&lt;/a&gt;! I guess we were close, just had the /24 in the wrong place!&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 17:15:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Iterate-through-hours-between-timestamps/m-p/2498984#M102935</guid>
      <dc:creator>covenant_bi</dc:creator>
      <dc:date>2024-12-20T17:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate through hours between timestamps</title>
      <link>https://community.qlik.com/t5/App-Development/Iterate-through-hours-between-timestamps/m-p/2498985#M102936</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/287708"&gt;@Clement15&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This worked as well. I like the Intervalmatch and autogenerate of the hourly data in it's own table&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 17:25:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Iterate-through-hours-between-timestamps/m-p/2498985#M102936</guid>
      <dc:creator>covenant_bi</dc:creator>
      <dc:date>2024-12-20T17:25:49Z</dc:date>
    </item>
  </channel>
</rss>

