Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Can't get IntervalMatch to work

Hi,

I've been using IntervalMatch in a QV application, but it creates a lot of synthetic keys. Therfore I'm working on understandig the IntervalMatch function. I started out with the examples from the QV helpfile, and cannot get it right. Clearly I'm missing something. I'd like to know, what I'm doing wrong.

1 Solution

Accepted Solutions
MarcoWedel

Hi Renskje,

although your solution should work perfectly with the synthetic keys included in your data model, you could get rid of them e.g. like this:

tabEventlog:

LOAD

  Time,

  Event,

  Comment

FROM

(biff, embedded labels, table is [Sheet1$]);

tabOrderlog:

LOAD

  Start,

  End,

  Order

FROM

(biff, embedded labels, table is [Sheet1$]);

tabTempIntervalMatch:

IntervalMatch (Time)

LOAD distinct Start, End Resident tabOrderlog;

Left Join (tabEventlog)

LOAD Distinct

  Time,

  Time(Start, 'hh:mm')&'-'&Time(End, 'hh:mm')as %OrderStartEnd

Resident tabTempIntervalMatch;

DROP Table tabTempIntervalMatch;

Left Join (tabOrderlog)

LOAD Distinct

  Start,

  End,

  Time(Start, 'hh:mm')&'-'&Time(End, 'hh:mm')as %OrderStartEnd

Resident tabOrderlog;

This script turns this data model

QlikCommunity_Thread_110368_Pic1.JPG.jpg

into this

QlikCommunity_Thread_110368_Pic2.JPG.jpg

no synthetic key tables, simply one additional key field per table

QlikCommunity_Thread_110368_Pic3.JPG.jpg

QlikCommunity_Thread_110368_Pic4.JPG.jpg

hope this helps

regards

Marco

View solution in original post

9 Replies
Not applicable
Author

I don't know much of it myself, but this might help you learn about it

IntervalMatch

by Henric Cronström

Cheers,

Lucas

MK_QSL
MVP
MVP

Eventlog:

LOAD Time,

     Event,

     Comment

FROM

(ooxml, embedded labels, table is Sheet1);

Orderlog:

LOAD Start,

     End,

     Order

FROM

(ooxml, embedded labels, table is Sheet1);

//SQL SELECT * FROM OrderLog;

//SQL SELECT * FROM Eventlog;

IntervalMatch (Time)

Load distinct Start, End resident OrderLog;

Left Join (Eventlog) Load * Resident Orderlog;

Drop Table Orderlog;

MarcoWedel

Hi Renskje,

although your solution should work perfectly with the synthetic keys included in your data model, you could get rid of them e.g. like this:

tabEventlog:

LOAD

  Time,

  Event,

  Comment

FROM

(biff, embedded labels, table is [Sheet1$]);

tabOrderlog:

LOAD

  Start,

  End,

  Order

FROM

(biff, embedded labels, table is [Sheet1$]);

tabTempIntervalMatch:

IntervalMatch (Time)

LOAD distinct Start, End Resident tabOrderlog;

Left Join (tabEventlog)

LOAD Distinct

  Time,

  Time(Start, 'hh:mm')&'-'&Time(End, 'hh:mm')as %OrderStartEnd

Resident tabTempIntervalMatch;

DROP Table tabTempIntervalMatch;

Left Join (tabOrderlog)

LOAD Distinct

  Start,

  End,

  Time(Start, 'hh:mm')&'-'&Time(End, 'hh:mm')as %OrderStartEnd

Resident tabOrderlog;

This script turns this data model

QlikCommunity_Thread_110368_Pic1.JPG.jpg

into this

QlikCommunity_Thread_110368_Pic2.JPG.jpg

no synthetic key tables, simply one additional key field per table

QlikCommunity_Thread_110368_Pic3.JPG.jpg

QlikCommunity_Thread_110368_Pic4.JPG.jpg

hope this helps

regards

Marco

Not applicable
Author

Tried that already, but didn't help

Not applicable
Author

Unfortunately, there will still be synthetic keys.

Not applicable
Author

Thanks very much! It works, all synthetic keys are removed. Very helpful with all the information on data model and final sheet!

MarcoWedel

nice to hear that it works for you.

Did you intentionally mark your own comment as the correct answer?   😉

regards

Marco

Not applicable
Author

Haha, just proved myself to be a rookie

MarcoWedel