Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Match original and overridden values from two tables

Hi All,

I need a solution which I'll be demonstrating through the below image:

Override.PNG

As you can see, we have two table Original and Overrided respectively. The Original table is holding the Original value and the Overrided table holds the value overriden by the customer. As you can, there's a common column Key with matching values and 'Value in Original table is similar to Original Value in the Overrided table'.

So, if the value gets overridden then it has to be picked from Overrided table for e.g. Key=1, Value and Original Value=50, Overrided Value=55. The value 50 should be replaced by 55.

Similarly, 'Key=2, Value and Original value=60, Overrided value=0'. Here, the Overrided value is Zero so it should pick value as 60.

Similarly, 'Key=3, Value and Original value=0, Overrided value=70'. Here, the Original value is Zero so it should pick value as 70 i.e. Overrided value.


Could anyone please help me in this scenario and let me get the solution.


Thanks in advance.


Regards,

Zain Shaikh

1 Solution

Accepted Solutions
antoniotiman
Honored Contributor III

Re: Match original and overridden values from two tables

Hi Zain,

Temp:
LOAD * INLINE [
Key,Value
1,50
2,60
3,0
]
;

Join LOAD * INLINE [
Key,Original,Overrided
1,50,55
2,60,0
3,0,70
]
;
NoConcatenate
LOAD Key,Original,Overrided,
If(Overrided > Original,Overrided,Value) as Value
Resident Temp;
Drop Table
Temp

Regards,

Antonio

2 Replies
antoniotiman
Honored Contributor III

Re: Match original and overridden values from two tables

Hi Zain,

Temp:
LOAD * INLINE [
Key,Value
1,50
2,60
3,0
]
;

Join LOAD * INLINE [
Key,Original,Overrided
1,50,55
2,60,0
3,0,70
]
;
NoConcatenate
LOAD Key,Original,Overrided,
If(Overrided > Original,Overrided,Value) as Value
Resident Temp;
Drop Table
Temp

Regards,

Antonio

Not applicable

Re: Match original and overridden values from two tables

Thanks Antonio. Mine approach is different but, your answer gave me a way to get the solution.

I followed similar steps with some joins and I got it. Really appreciated.

Community Browser