<?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: IntervalMatch does not work in Connectivity &amp; Data Prep</title>
    <link>https://community.qlik.com/t5/Connectivity-Data-Prep/IntervalMatch-does-not-work/m-p/2461940#M13811</link>
    <description>&lt;P&gt;Your Start and End fields are just times -- fractions of a day. Your EndTime field is a full timestamp, integer date + time fraction. I believe you will want to modify your EndTime load to exclude the date portion.&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;time(&lt;FONT color="#000080"&gt;&lt;STRONG&gt;frac(&lt;/STRONG&gt;&lt;/FONT&gt;timestamp(DTENDE, 'YYYY-MM-DD hh:mm:ss:fff')&lt;FONT color="#000080"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;,'hh:mm:ss') as EndTime;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;-Rob&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jun 2024 22:07:37 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2024-06-12T22:07:37Z</dc:date>
    <item>
      <title>IntervalMatch does not work</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/IntervalMatch-does-not-work/m-p/2461828#M13808</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Could you please help me to figure out, why this script returns nothing?&lt;/P&gt;
&lt;P&gt;The EndTime vqlue is correct, I can see it, but the match doesn´t work&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LOAD &lt;BR /&gt;time(timestamp(DTENDE, 'YYYY-MM-DD hh:mm:ss:fff'),'hh:mm:ss') as EndTime;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;[TimeStamps]:&lt;/P&gt;
&lt;P&gt;SELECT "DTENDE"&lt;BR /&gt;FROM "PJ_VD";&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;[Shifts]:&lt;/P&gt;
&lt;P&gt;LOAD * Inline [&lt;BR /&gt;Start, End, Shift&lt;BR /&gt;07:00:00, 14:59:59, Shift 1&lt;BR /&gt;15:00:00, 22:59:59, Shift 2&lt;BR /&gt;23:00:00, 06:59:59, Shift 3&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;//Link the field EndTime to the time intervals defined by the fields Start and End.&lt;BR /&gt;Inner Join IntervalMatch (EndTime) &lt;BR /&gt;LOAD Start, End&lt;BR /&gt;Resident Shifts;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 16:36:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/IntervalMatch-does-not-work/m-p/2461828#M13808</guid>
      <dc:creator>mariam_vd</dc:creator>
      <dc:date>2024-06-12T16:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: IntervalMatch does not work</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/IntervalMatch-does-not-work/m-p/2461856#M13810</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/302522"&gt;@mariam_vd&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Date and Time always causes some confusion in Qlik.&lt;BR /&gt;You have to understand that Qlik basically has two data types: strings and numbers.&lt;/P&gt;
&lt;P&gt;Date and Time, or Timestamp values are composed by two numeric parts. An Integer part (date) and the decimals (time).&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Time()&lt;/STRONG&gt;, &lt;STRONG&gt;Date()&lt;/STRONG&gt;, &lt;STRONG&gt;TimeStamp()&lt;/STRONG&gt; functions are just format functions, meaning, these functions DON'T change the value of the field, even if it is displayed so.&lt;/P&gt;
&lt;P&gt;But, Qlik offers functions that actually change the value of fields. Those are: &lt;STRONG&gt;Time#()&lt;/STRONG&gt;, &lt;STRONG&gt;Date#()&lt;/STRONG&gt;, &lt;STRONG&gt;TimeStamp#()&lt;/STRONG&gt; and other Match functions to extract date and time portions like &lt;STRONG&gt;Floor()&lt;/STRONG&gt; and &lt;STRONG&gt;Frac()&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;So, probably your &lt;STRONG&gt;IntervalMatch&lt;/STRONG&gt; is not working because the values are not compatible, so you have to transform the values correctly.&lt;/P&gt;
&lt;P&gt;This is how you can manipulate the Date and Time values using Floor and Frac:&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="marksouzacosta_0-1718214568669.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/167842iBF1142EA44D37780/image-size/medium?v=v2&amp;amp;px=400" role="button" title="marksouzacosta_0-1718214568669.png" alt="marksouzacosta_0-1718214568669.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And this is how you can try to adjust your Load Script to convert correctly the values.&lt;BR /&gt;Please note that I don't know your database values so I'm assuming it is a Date and Time field.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[TimeStamps]:
LOAD
	"DTENDE" AS SourceEndDateTime,
    Date(Floor("DTENDE")) AS EnDate, // Floor changes the value, Date visually format the value
    Time(Frac("DTENDE")) AS EnTime // Frac changes the value, Time visually format the value
;
SELECT
	"DTENDE"
FROM
	"PJ_VD"
;


[Shifts]:
LOAD
// Use these functions, just in case
Time#(Start,'hh:mm:ss') AS Start, // Time# convert the value
Time#(End,'hh:mm:ss') AS End, // Time# convert the value
Shift
Inline [
Start, End, Shift
07:00:00, 14:59:59, Shift 1
15:00:00, 22:59:59, Shift 2
23:00:00, 06:59:59, Shift 3
];

//Link the field EndTime to the time intervals defined by the fields Start and End.
Inner Join IntervalMatch (EndTime)
LOAD Start, End
Resident Shifts;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Mark Costa&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 18:06:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/IntervalMatch-does-not-work/m-p/2461856#M13810</guid>
      <dc:creator>marksouzacosta</dc:creator>
      <dc:date>2024-06-12T18:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: IntervalMatch does not work</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/IntervalMatch-does-not-work/m-p/2461940#M13811</link>
      <description>&lt;P&gt;Your Start and End fields are just times -- fractions of a day. Your EndTime field is a full timestamp, integer date + time fraction. I believe you will want to modify your EndTime load to exclude the date portion.&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;time(&lt;FONT color="#000080"&gt;&lt;STRONG&gt;frac(&lt;/STRONG&gt;&lt;/FONT&gt;timestamp(DTENDE, 'YYYY-MM-DD hh:mm:ss:fff')&lt;FONT color="#000080"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;,'hh:mm:ss') as EndTime;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;-Rob&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 22:07:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/IntervalMatch-does-not-work/m-p/2461940#M13811</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2024-06-12T22:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: IntervalMatch does not work</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/IntervalMatch-does-not-work/m-p/2462292#M13819</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/6148"&gt;@rwunderlich&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A id="link_15" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://community.qlik.com/t5/user/viewprofilepage/user-id/6148" target="_self" aria-label="View Profile of rwunderlich" aria-describedby="userProfileCard-6148"&gt;&lt;SPAN class="login-bold"&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/22035"&gt;@marksouzacosta&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="login-bold"&gt;Thanks a lot for your replies&lt;BR /&gt;Indeed, using fraction of the timestamp helped to make the IntervalMatch start working.&lt;BR /&gt;&lt;BR /&gt;Although, this task is still giving me hard times:&lt;BR /&gt;&lt;BR /&gt;1) for defining the overnight interval (23h-07h) I had to set it twice: 23-24 &amp;amp; 00-07&amp;nbsp;&lt;BR /&gt;Is there another way to do that?&lt;BR /&gt;&lt;BR /&gt;2) I have an operations at 06:59:59 and 07:00:00 as well as those at 16:59:59 and 17:00:00 which lay on the interval borders&lt;BR /&gt;and the logic for defining the shift is different:&lt;BR /&gt;I understand that the reason for that is that the num() of those time values is not the same as the num() of the interval borders&lt;BR /&gt;&lt;BR /&gt;But how can I round the time value, so that I can be sure that the logic of the system is aligned with user expectation (they want 06:59 be always in Shift 3 and 07:00 in Shift 1)&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="login-bold"&gt;3) when I set the time() format to hh:mm:ss:fff the num() of that time value doesn't work&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="login-bold"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 16:03:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/IntervalMatch-does-not-work/m-p/2462292#M13819</guid>
      <dc:creator>mariam_vd</dc:creator>
      <dc:date>2024-06-13T16:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: IntervalMatch does not work</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/IntervalMatch-does-not-work/m-p/2462295#M13820</link>
      <description>&lt;P&gt;See&amp;nbsp;&lt;A href="https://qlikviewcookbook.com/2023/08/creating-time-groups-in-your-data-model/" target="_blank"&gt;https://qlikviewcookbook.com/2023/08/creating-time-groups-in-your-data-model/&lt;/A&gt;&amp;nbsp;for some tips.&lt;/P&gt;
&lt;P&gt;-Rob&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 16:19:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/IntervalMatch-does-not-work/m-p/2462295#M13820</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2024-06-13T16:19:48Z</dc:date>
    </item>
  </channel>
</rss>

