Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
madhubabum
Creator
Creator

How we can Perform Update(only) in incremental load ?

Hi Experts

How we can Implement Update only in Incremental load ?

Note : Ignore Insert records (Perform only Update )

Thanks

Madhu

1 Solution

Accepted Solutions
effinty2112
Master
Master

Hi madhu,

This script gives you the table of your original data but with modification to changed records and without addition of new:

Key Hours Status
1002Completed
1013Completed
10210Completed

There's a lot of renaming and dropping going on here and it can possibly be simplified. Anyway here it is:

OldDataSet:

Load

*,

Hash128(Key & '|' & Hours & '|' &  Status) as HashKey;

Load * Inline [

Key, Hours, Status

100, 2, Completed

101, 3, Completed

102, 4, Pending];

NoConcatenate

ModifiedData:

Load

*

Where Exists(Key) and Not Exists(HashKey);

Load

*,

Hash128(Key & '|' & Hours & '|' &  Status) as HashKey;

Load * Inline [

Key, Hours, Status

100, 2, Completed

101, 3, Completed

102, 10, Completed

103, 5, Completed];

Drop Field HashKey;

ModifiedData1:

Load

Key as ModKey,

Hours,

Status

Resident ModifiedData;

drop Table ModifiedData;

RENAME Table ModifiedData1 to ModifiedData;

NoConcatenate

NewDataSet:

Load * Resident OldDataSet Where Not Exists(ModKey, Key);

DROP Table OldDataSet;

NoConcatenate

ModifiedData1:

Load

ModKey as Key,

Hours,

Status

Resident ModifiedData;

drop Table ModifiedData;

RENAME Table ModifiedData1 to ModifiedData;

Concatenate (NewDataSet)

LOAD * Resident ModifiedData;

DROP Table ModifiedData;

View solution in original post

10 Replies
madhubabum
Creator
Creator
Author

Thanks for reply

In our case we are not using Date field

Example :

OldDataSet:

Key,Hours,Status

100,2,Completed

101,3,Completed

102,4,Pending

NewDataSet:

100,2,Completed

101,3,Completed

102,10,Completed

103,5,Completed

Here I want to update(only) , which record is modified (102 record only)

I dont want to load new record .

Please help to write the script

Thanks

Madhu

effinty2112
Master
Master

Hi madhu,

This script will give you a table called ModifiedData

Key Hours Status
10210Completed

OldDataSet:

Load

*,

Hash128(Key & '|' & Hours & '|' &  Status) as HashKey;

Load * Inline [

Key, Hours, Status

100, 2, Completed

101, 3, Completed

102, 4, Pending];

NoConcatenate

ModifiedData:

Load

*

Where Exists(Key) and Not Exists(HashKey);

Load

*,

Hash128(Key & '|' & Hours & '|' &  Status) as HashKey;

Load * Inline [

Key, Hours, Status

100, 2, Completed

101, 3, Completed

102, 10, Completed

103, 5, Completed];

Drop Table OldDataSet;

Drop Field HashKey;

madhubabum
Creator
Creator
Author

Thanks for Your Reply

Itz working Perfectly

effinty2112
Master
Master

Hi madhu,

This script gives you the table of your original data but with modification to changed records and without addition of new:

Key Hours Status
1002Completed
1013Completed
10210Completed

There's a lot of renaming and dropping going on here and it can possibly be simplified. Anyway here it is:

OldDataSet:

Load

*,

Hash128(Key & '|' & Hours & '|' &  Status) as HashKey;

Load * Inline [

Key, Hours, Status

100, 2, Completed

101, 3, Completed

102, 4, Pending];

NoConcatenate

ModifiedData:

Load

*

Where Exists(Key) and Not Exists(HashKey);

Load

*,

Hash128(Key & '|' & Hours & '|' &  Status) as HashKey;

Load * Inline [

Key, Hours, Status

100, 2, Completed

101, 3, Completed

102, 10, Completed

103, 5, Completed];

Drop Field HashKey;

ModifiedData1:

Load

Key as ModKey,

Hours,

Status

Resident ModifiedData;

drop Table ModifiedData;

RENAME Table ModifiedData1 to ModifiedData;

NoConcatenate

NewDataSet:

Load * Resident OldDataSet Where Not Exists(ModKey, Key);

DROP Table OldDataSet;

NoConcatenate

ModifiedData1:

Load

ModKey as Key,

Hours,

Status

Resident ModifiedData;

drop Table ModifiedData;

RENAME Table ModifiedData1 to ModifiedData;

Concatenate (NewDataSet)

LOAD * Resident ModifiedData;

DROP Table ModifiedData;

madhubabum
Creator
Creator
Author

Thanks Andrew Walker ,

Script working fine

richard_chilvers
Specialist
Specialist

Please mark the correct answer.

effinty2112
Master
Master

Thank you Richard.