Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Save $300 - Register for QlikWorld (formerly Qonnections) by January 31st: Learn More
wilesmitha
New Contributor

Update record if value has changed since last load

Hi,

I have the below table 1:

IDcol 1col 2
110a
211b
312c

 

and some new data like this:

IDcol 1col 2
121b
215b
316c

 

I need to update col 1 and col 2 in table 1 but only if the value of col 1 since its last load has changed more than 10. the result would look like this:

IDcol 1col 2
121 b
211b
312c

 

I've tried googling how to do this but i just dont know exactly what to google to find similar examples of this problem.

 

3 Replies
Partner
Partner

Re: Update record if value has changed since last load

You can't update the values inside the table. First you need to join the tables and rename col1 and col2:

Left Join (table 1)

Load

ID,

col1 as col1new,

col2 as colnew2

resident table 2;

 

and then reload table 1 and create new field for col1 and col2 once again:

tablefinal:

load

ID,

IF(col1new-col1)>10,col1new,col1) as col1final,

IF(col1new-col1)>10,col2new,col2) as col2final

resident table1;

and drop tables 1 & 2 so you don't have unnecessary fields

wilesmitha
New Contributor

Re: Update record if value has changed since last load

Hi, Thanks for getting back to me 🙂 the new data is data in a sql DB, hasnt been loaded into qliksense. below is all i have at the moment, just a load script. I think I'm begging to understand the logic behind your method. Do I need to have the 2 tables in qliksense then join them or can this be done off the initial load?

Load ID,

Col1,

Col2;

[Table1]:

Select ID,

Col1,

Col2

FROM testdb..table1;

Highlighted
Partner
Partner

Re: Update record if value has changed since last load

You can do this in initial load. You can even use join in SQL statement and load that statement if that works for you.

To be clear, in what I described you need to: load table1, join table2, load table1 once again (as new table) with the condition (delete table1 or fields depending if you loaded new table or added fields)