Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

IntervalMatch query

Hello Community,

My source tables:

Tab1:

load * inline [ Id,Start,End,Value1

1,0,59,111

1,60,100,112

2,0,100,444];

Tab2:

load * inline [ Id,Start,End,Value2

1,0,10,X

1,11,100,Y

2,0,80,A

2,81,100,B];

PointTab:

load * inline [ Id,Point

1,40

1,70

2,50];

My goal is:

Id, Point, Value1, Value2

1, 40, 111, Y

1, 70, 112, Y

2, 50, 444, A

How can I get this result? (IntervalMatch...?)

Thanks!

2 Replies
sunny_talwar

Try this

Tab1:

LOAD * INLINE [

    Id, Start, End, Value1

    1, 0, 59, 111

    1, 60, 100, 112

    2, 0, 100, 444

];


Tab2:

LOAD Id,

Start as Start2,

End as End2,

Value2;

LOAD * INLINE [

    Id, Start, End, Value2

    1, 0, 10, X

    1, 11, 100, Y

    2, 0, 80, A

    2, 81, 100, B

];


PointTab:

LOAD * INLINE [

    Id, Point

    1, 40

    1, 70

    2, 50

];


Left Join (PointTab)

IntervalMatch(Point, Id)

LOAD Start,

End,

Id

Resident Tab1;


Left Join (PointTab)

LOAD *

Resident Tab1;


Left Join (PointTab)

IntervalMatch(Point, Id)

LOAD Start2,

End2,

Id

Resident Tab2;


Left Join (PointTab)

LOAD *

Resident Tab2;


DROP Tables Tab1, Tab2;

DROP Fields Start, Start2, End, End2;


Capture.PNG

Anonymous
Not applicable
Author

Hello Sunny,

great, thanks so match !

Olaf