Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

Updating a record

Hello everyone,

I'm trying to update a qvd file with qvd file.

The code that I'm using is

Invoices:
LOAD %Invoice_KEY ,
// %Invoice_KEY ,
     InvoiceCode,
     CustomerID,
     CustomerName,
     Description,
     InvoiceDate,
     InvoiceTotal
FROM QVD\Invoices.qvd(qvd);

Concatenate
LOAD %Invoice_KEY ,
     InvoiceCode,
     CustomerID,
     CustomerName,
     Description,
     InvoiceDate,
     InvoiceTotal
FROM
QVD\Invoices_Payments_updates.qvd
(qvd)
Where Exists(%Invoice_KEY);

Demo.png


But I get two records instead of the second one...

Can someone, please, help me?

Thanks in advance for the attention.

Kind regards

Piskitta

Tags (4)
1 Solution

Accepted Solutions
Not applicable

Updating a record

Hallo piskitta,

If I look at your code it should be correct that you get two records.

You have a Where statement that says that you want to concatenate the rows on a keyfield that already exists.

You do not delete the old one!

Kind regards

Gert

9 Replies
Not applicable

Updating a record

Hallo piskitta,

If I look at your code it should be correct that you get two records.

You have a Where statement that says that you want to concatenate the rows on a keyfield that already exists.

You do not delete the old one!

Kind regards

Gert

Not applicable

Updating a record

Hi Gert,

Thank you for answering in such a short time.

I realise what you're saying. I'm really in new in Qlikview enviornment, so it's still really difficult to see those mistakes...

Can you tell me how to delete the old record?

Thanks.

Kind regards

Not applicable

Updating a record

Hallo piskitta,

For an update you will need to have a modification time. Meaning with the first QVD load you check the modification time like: WHERE ModificationTime >=#$(LastExecTime)#;

Then you perform a Concatenate with the new data with a where NOT clause like:WHERE NOT Exists(PrimaryKey);

Hope this helps!

Gert

Not applicable

Updating a record

Thank you Gert, once again.

Kind regards

Piskitta

MVP & Luminary
MVP & Luminary

Updating a record

Your condtion should be

Where NOT Exists(%Invoice_Key)

-Rob


Not applicable

Updating a record

Rob's answer is faster, but using Rob's answer it is important in what sequence you will load the QVD's

Not applicable

Updating a record

Hello Rob and Gert

I think I'm not being correct in my words... Sorry...

My intention is update only two columns of the same line.

I tested the solutions that are being presented but they return only the new records.

I don't change my primary keys because it's not a new record that i'm trying to insert. I'm trying to update the information of the column with a defined primary key...

Is this even possible?!

Thanks for your help.

Kind regards

Piskitta

MVP & Luminary
MVP & Luminary

Updating a record

You should load the updates.qvd first.

-Rob

Not applicable

Updating a record

Thanks Rob.

Sometimes we justr can't see the trees in the florest...

Kind regards

Piskitta