<?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 MAPPING in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Intervalmatch-MAPPING/m-p/2485970#M101329</link>
    <description>&lt;P&gt;Unfortunately, it's not possible to use an interval match when the key is not distinct in this case.&lt;/P&gt;</description>
    <pubDate>Tue, 08 Oct 2024 15:59:30 GMT</pubDate>
    <dc:creator>SonPhanHumanIT</dc:creator>
    <dc:date>2024-10-08T15:59:30Z</dc:date>
    <item>
      <title>Intervalmatch MAPPING</title>
      <link>https://community.qlik.com/t5/App-Development/Intervalmatch-MAPPING/m-p/2485923#M101324</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have a relatively simple task, but I’m currently stuck at one point.&lt;/P&gt;
&lt;P&gt;I want to create something similar to an &lt;EM&gt;Intervalmatch&lt;/EM&gt;, but optimized for mapping, as a traditional Intervalmatch would take too long in this case.&lt;/P&gt;
&lt;P&gt;I have a mapping table with timestamps, which usually differ only slightly from those in the target table, but in most cases, they almost match. Now, I’d like to define an additional column that maps the correct value from the mapping table to the target table, as long as the timestamp in the mapping table doesn't deviate by more than 10 seconds in the past.&lt;/P&gt;
&lt;P&gt;Here’s a sample code to illustrate:&lt;/P&gt;
&lt;PRE&gt;MAPPING_TABLE:&lt;BR /&gt;MAPPING LOAD&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt; KEY &amp;amp; '-' &amp;amp; Date &amp;amp; '-' &amp;amp; Time,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Time&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; INLINE [&lt;/SPAN&gt;&lt;BR /&gt;KEY, Date,Time,&lt;BR /&gt;1, 22.05.2024,13:10:41&lt;BR /&gt;1, 22.05.2024,13:11:40&lt;BR /&gt;1, 22.05.2024,13:11:37&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;TABLE2:&lt;BR /&gt;LOAD *,&lt;BR /&gt;&lt;SPAN&gt; APPLYMAP('MAPPING_TABLE', KEY &amp;amp; '-' &amp;amp; Date2, 'N/A') AS Time; // Need the correct code here;&lt;/SPAN&gt;&lt;BR /&gt;LOAD *,&lt;BR /&gt;&lt;SPAN&gt; Time(Time2 - MakeTime(0, 0, 10)) AS TimeDelta&lt;/SPAN&gt;&lt;BR /&gt;INLINE [&lt;BR /&gt;KEY, Date2, Time2&lt;BR /&gt;1, 22.05.2024, 13:11:45&lt;BR /&gt;1, 22.05.2024, 13:11:41&lt;BR /&gt;1, 22.05.2024, 13:11:38&lt;BR /&gt;];&lt;/PRE&gt;
&lt;P&gt;My goal is to create the following table:&lt;/P&gt;
&lt;PRE&gt;GOAL_TABLE:&lt;BR /&gt;LOAD *&lt;BR /&gt;INLINE [&lt;BR /&gt;KEY, Date2, Time2, Time,&lt;BR /&gt;1, 22.05.2024, 13:11:45, N/A&lt;BR /&gt;1, 22.05.2024, 13:11:41, 13:11:40&lt;BR /&gt;1, 22.05.2024, 13:11:38, 13:11:37&lt;BR /&gt;];&lt;/PRE&gt;
&lt;P&gt;Hopfefully you can support me here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards Son&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2024 14:26:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Intervalmatch-MAPPING/m-p/2485923#M101324</guid>
      <dc:creator>SonPhanHumanIT</dc:creator>
      <dc:date>2024-10-08T14:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: Intervalmatch MAPPING</title>
      <link>https://community.qlik.com/t5/App-Development/Intervalmatch-MAPPING/m-p/2485956#M101327</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/225864"&gt;@SonPhanHumanIT&lt;/a&gt;&amp;nbsp; It's just your assumption or you already tried Intervalmatch approach to find that it's taking too long?&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2024 15:15:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Intervalmatch-MAPPING/m-p/2485956#M101327</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-10-08T15:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: Intervalmatch MAPPING</title>
      <link>https://community.qlik.com/t5/App-Development/Intervalmatch-MAPPING/m-p/2485968#M101328</link>
      <description>&lt;P&gt;personally, i wouldnt take this route but yeah if you require to take this route probably you could try something like below:&lt;/P&gt;
&lt;P&gt;TABLE1:&lt;BR /&gt;LOAD Date1,&lt;BR /&gt;Time1,&lt;BR /&gt;SUBFIELD(Time1,':',3) AS Seconds1,&lt;BR /&gt;RowNo() AS %KEY;&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;KEY, Date1,Time1,&lt;BR /&gt;1, 22.05.2024,13:10:41&lt;BR /&gt;1, 22.05.2024,13:11:40&lt;BR /&gt;1, 22.05.2024,13:11:37&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;JOIN(TABLE1)&lt;BR /&gt;TABLE2:&lt;BR /&gt;LOAD KEY,&lt;BR /&gt;Date2,&lt;BR /&gt;Time2,&lt;BR /&gt;SUBFIELD(Time2,':',3) AS Seconds2,&lt;BR /&gt;RowNo() AS %KEY;&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;KEY, Date2, Time2&lt;BR /&gt;1, 22.05.2024, 13:11:45&lt;BR /&gt;1, 22.05.2024, 13:11:41&lt;BR /&gt;1, 22.05.2024, 13:11:38&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;set vtimedelta = 2;&lt;/P&gt;
&lt;P&gt;NOCONCATENATE&lt;BR /&gt;TABLE:&lt;BR /&gt;LOAD *,&lt;BR /&gt;if((Seconds2 &amp;lt; Seconds1 + $(vtimedelta)) or (Seconds2 &amp;lt; Seconds1 - $(vtimedelta)), Time1, 'NA') as Time_Filled&lt;BR /&gt;RESIDENT TABLE1; &lt;BR /&gt;DROP TABLES TABLE1;&lt;BR /&gt;DROP FIELDS Seconds1, Seconds2;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2485923 - Intervalmatch MAPPING (1).PNG" style="width: 620px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/172671iF4061DAA8E023B29/image-size/large?v=v2&amp;amp;px=999" role="button" title="2485923 - Intervalmatch MAPPING (1).PNG" alt="2485923 - Intervalmatch MAPPING (1).PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2024 15:44:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Intervalmatch-MAPPING/m-p/2485968#M101328</guid>
      <dc:creator>Qrishna</dc:creator>
      <dc:date>2024-10-08T15:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: Intervalmatch MAPPING</title>
      <link>https://community.qlik.com/t5/App-Development/Intervalmatch-MAPPING/m-p/2485970#M101329</link>
      <description>&lt;P&gt;Unfortunately, it's not possible to use an interval match when the key is not distinct in this case.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2024 15:59:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Intervalmatch-MAPPING/m-p/2485970#M101329</guid>
      <dc:creator>SonPhanHumanIT</dc:creator>
      <dc:date>2024-10-08T15:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: Intervalmatch MAPPING</title>
      <link>https://community.qlik.com/t5/App-Development/Intervalmatch-MAPPING/m-p/2485971#M101330</link>
      <description>&lt;P&gt;In your case, you would need to sort the &lt;CODE&gt;Time2&lt;/CODE&gt; values, but this could lead to an error if you try to match a range, such as from 13:12:01 to 13:11:59. However, thanks for your suggestion!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2024 16:01:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Intervalmatch-MAPPING/m-p/2485971#M101330</guid>
      <dc:creator>SonPhanHumanIT</dc:creator>
      <dc:date>2024-10-08T16:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Intervalmatch MAPPING</title>
      <link>https://community.qlik.com/t5/App-Development/Intervalmatch-MAPPING/m-p/2485980#M101331</link>
      <description>&lt;P&gt;Thats not an issue as long as you %KEY matches from the tables no matter what your order in the tbale is.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2024 16:15:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Intervalmatch-MAPPING/m-p/2485980#M101331</guid>
      <dc:creator>Qrishna</dc:creator>
      <dc:date>2024-10-08T16:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: Intervalmatch MAPPING</title>
      <link>https://community.qlik.com/t5/App-Development/Intervalmatch-MAPPING/m-p/2486176#M101357</link>
      <description>&lt;P&gt;An intervalmatch isn't needed else the mapping-table could be expanded to all necessary combinations of values, for example with a while-loop, like here simplified:&lt;/P&gt;
&lt;P&gt;mapping load key &amp;amp; '|' &amp;amp; (from + iterno() - 1) as lookup, from as return&lt;BR /&gt;from X while&amp;nbsp;from + iterno() - 1 &amp;lt;= from + 10;&lt;/P&gt;
&lt;P&gt;This means the essential part is to prepare the mapping-table and depending on the real complexity the task might be distributed to n steps in preparing the data with n conditions/transformations and with n forward/backward loops and so on ... By larger data-sets it might also useful to filter in beforehand the mapping and the facts per exists() against each other to exclude those ones which don't need an adjustment.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 11:25:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Intervalmatch-MAPPING/m-p/2486176#M101357</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2024-10-09T11:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: Intervalmatch MAPPING</title>
      <link>https://community.qlik.com/t5/App-Development/Intervalmatch-MAPPING/m-p/2486364#M101379</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/225864"&gt;@SonPhanHumanIT&lt;/a&gt;&amp;nbsp; It seems complex transformation. It should be done in ETL ideally if data volumes are huge. If data volumes are not huge then you can try something below. It does cross join on Key,Date &amp;amp; Time which is heavy operation&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data:&lt;BR /&gt;LOAD *,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; KEY &amp;amp; '|' &amp;amp; Date &amp;amp; '|' &amp;amp; Time as _key,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Time(Time - MakeTime(0, 0, 10)) AS TimeFrom&lt;BR /&gt;INLINE [&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;KEY&lt;/FONT&gt;, &lt;FONT color="#FF0000"&gt;Date&lt;/FONT&gt;, Time&lt;BR /&gt;1, 22.05.2024, 13:11:45&lt;BR /&gt;1, 22.05.2024, 13:11:41&lt;BR /&gt;1, 22.05.2024, 13:11:38&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;Join(Data)&lt;BR /&gt;//Mapping table&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;KEY&lt;/FONT&gt;, &lt;FONT color="#FF0000"&gt;Date&lt;/FONT&gt;,Time_To_Map&lt;BR /&gt;1, 22.05.2024,13:10:41&lt;BR /&gt;1, 22.05.2024,13:11:40&lt;BR /&gt;1, 22.05.2024,13:11:37&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;T1:&lt;BR /&gt;Load *,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if(floor(interval(Time_To_Map-TimeFrom,'hh:mm:ss'))&amp;gt;=0 and&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;second(interval(Time_To_Map-TimeFrom,'hh:mm:ss'))&amp;lt;=10,1,0) as Flag1&lt;BR /&gt;Resident Data;&lt;/P&gt;
&lt;P&gt;Drop Table Data;&lt;/P&gt;
&lt;P&gt;T2:&lt;BR /&gt;Load *,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if(KEY = Previous(KEY) and Date = Previous(Date) and Time_To_Map=Previous(Time_To_Map)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;and Previous(Flag1)=1,0,Flag1) as Flag&lt;BR /&gt;Resident T1&lt;/P&gt;
&lt;P&gt;Where&amp;nbsp;Flag1=1&lt;BR /&gt;Order by KEY,Date,Time_To_Map,Time;&lt;/P&gt;
&lt;P&gt;Drop Table T1;&lt;/P&gt;
&lt;P&gt;Final:&lt;BR /&gt;NoConcatenate&lt;BR /&gt;Load *&lt;BR /&gt;Resident T2&lt;BR /&gt;where Flag=1;&lt;/P&gt;
&lt;P&gt;Drop Table T2;&lt;/P&gt;
&lt;P&gt;// Append not existed keys from original table to list not mapped records.&lt;/P&gt;
&lt;P&gt;Concatenate(Final)&lt;BR /&gt;LOAD *&lt;BR /&gt;where not Exists(_key);&lt;BR /&gt;LOAD *,KEY &amp;amp; '|' &amp;amp; Date &amp;amp; '|' &amp;amp; Time as _key &lt;BR /&gt;INLINE [&lt;BR /&gt;KEY, Date, Time&lt;BR /&gt;1, 22.05.2024, 13:11:45&lt;BR /&gt;1, 22.05.2024, 13:11:41&lt;BR /&gt;1, 22.05.2024, 13:11:38&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;Drop Fields _key,Flag,Flag1,TimeFrom;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-10-09 202911.png" style="width: 427px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/172765iD96DE75C65F58590/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-10-09 202911.png" alt="Screenshot 2024-10-09 202911.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 11:06:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Intervalmatch-MAPPING/m-p/2486364#M101379</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-10-10T11:06:25Z</dc:date>
    </item>
  </channel>
</rss>

