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

table completed with data form different table

Hello,

I started to work with Qlik Sense for some month ago. The last days I have worked on following issue and could not fix it.

This table A is a list with the produced parts:

Date_ProductionPart_IDColour_ID
07.01.2020932580300
07.01.2020932581300
07.01.2020932582475
08.01.2020932971300
08.01.2020932972668
09.01.2020933357475
09.01.2020933358300

And the following table is the table B with the applied robots. The Date_Robot indicates the start of the production with the robot and the Colour ID “All” includes all colours except “300”.

Date_RobotColour_IDRobot_ID
01.01.2020All12
01.01.202030034
08.01.2020All34
08.01.202030012

At the end the table should look like this:

Date_ProductionPart_IDColour_IDRobot_ID
07.01.202093258030034
07.01.202093258130034
07.01.202093258247512
08.01.202093297130012
08.01.202093297266834
09.01.202093335747534
09.01.202093335830012

I have tried it already with “OUTER JOIN” combined witch “VARIABLE” in “DO-WHILE-LOOP”, but failed catastrophically. Have anybody an idea, how I should go on?

Regards,

TMK

1 Solution

Accepted Solutions
TMK
Contributor II
Contributor II
Author

Hi Pedro,

thank you very much for your help and your efforts. As I wrote in an reply before your suggestion is unfortunately not working in the way I need.

The last weeks I tried out different ideas. Finally I got it. The best way I found is to use "intervalmatch". See the app script.

 

Regards,

Tobi

View solution in original post

5 Replies
pedrobergo
Employee
Employee

Hi @TMK ,

I prepare a load script to you, 

  1. You need create a Temp table with only the 'ALL' Colour ID and crossjoin the TableA with it.
  2. Then you create a Final Table with the existing colours id at both tables A and B and join TableA with it.
  3. Sou you must to union the Temp Table with the Final Table
  4. DROP other tables to avoid synthetic keys

See the app script.

Good luck,

Pedro

Taoufiq_Zarra

what is the correlation between the two dates Date_Production and Date_Robot ?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
mueller-kambeitz
Contributor
Contributor

Hi  Peter,

Thank you very much for your help. I tried it already out, but unfortunately is this the result:

Date_ProductionPart_IDColour_IDRobot_ID
07.01.202093258030012
07.01.202093258030034
07.01.202093258130012
07.01.202093258130034
07.01.202093258247512
07.01.202093258247534
08.01.202093297130012
08.01.202093297130034
08.01.202093297266812
08.01.202093297266834
09.01.202093335747512
09.01.202093335747534
09.01.202093335830012
09.01.202093335830034

 

At this table each part has two different Robot_ID’s. But each part with its unique Part_ID should have only one Robot_ID.

I will try to use your load script and I hopefully can rework it to get finally the needed result. It would be great, if you would have a suggestion for the rework.

 

Kind regards,

Tobi

!!!Sorry for the confusion. Foolishly I have two logins (one for work and one for private) and mixed them up. I am TMK and Tobi!!!

TMK
Contributor II
Contributor II
Author

The Date_Production is the day of the production of the parts.

The Date_Robot is the day where a new setup of the robots were installed for the colours.

For example:

From 01/01/2020 till 01/07/2020 was the robot with Robot_ID 34 used for all parts with Colour_ID 300. With the begining of 01/08/2020 was the Robot_ID 12 used for part with Colour_ID 300.

Regards,

Tobi

TMK
Contributor II
Contributor II
Author

Hi Pedro,

thank you very much for your help and your efforts. As I wrote in an reply before your suggestion is unfortunately not working in the way I need.

The last weeks I tried out different ideas. Finally I got it. The best way I found is to use "intervalmatch". See the app script.

 

Regards,

Tobi