Dear all,
I´m new with Qlikview and I need a help with the follow:
From a load script like the bellow:
Test_table:
Load
Name
Date_a, // formato (YYYYMMDDHHMMSS)
RegID_a
Resident Base_a
Join
Load
Name
Date_b, // formato (YYYYMMDDHHMMSS)
RegID_b
Resident Base_b
I need to add a field in the above table with the track information of records from Base_a and Base_b.
So, I need a field RegID_ab with the RegID_a information in the lines that came from Base_b with the follow condition:
> From Date_a, what is the grater and nearst Data_b, considering same Name and Flag_a = Flag_b.
In the field Interval, I need the difference between dates (Date_a e Date_b) in seconds.
Exemple of expectation:
Name | Date_a | RegID_a | Flag_a | Date_b | RegID_b | Flag_b | RegID_ab | Interval |
John | 20180810145600 | A_01 | 10 | | | | | |
John | 20180810145803 | A_02 | 20 | | | | | |
Peter | 20180812040843 | A_03 | 10 | | | | | |
Susan | 20180825203201 | A_04 | 30 | | | | | |
Bill | 20180826101212 | A_05 | 10 | | | | | |
John | | | | 20180810145610 | B_01 | 10 | A_01 | 10 |
John | | | | 20180810145913 | B_02 | 20 | A_02 | 70 |
Andrew | | | | 20180812040843 | B_03 | 20 | | |
Peter | | | | 20180812041048 | B_04 | 10 | A_03 | 125 |
Jack | | | | 20180822181002 | B_05 | | | |
Susan | | | | 20180826000010 | B_06 | 30 | A_04 | 12489 |
Notes:
- I need to do this track in load process and not in DB.
- As showed in the above example, I can have records in both Bases with no correspondent records in the other base.
Sorry, but I cant download and open qvw files, so please answer with the suggested sript and I will test.
Thanks in advance !!!