Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

using key combination in incremental load

Hi guys,

I am doing incremental load and i have a statement like ...

// first step to get data from DB after a certain time period.

// vWhereClause contains that statement

NoConcatenate

        Temp_$(vResTable)_Incremental:

        LOAD

        $(AllColumnNames);

        SQL Select $(AllColumnNames) FROM $(vResTable)

        where $(vWhereClause);

// second step is to concatenate with our QVD file and add new or refreshed rows

Concatenate (Temp_$(vResTable)_Incremental)

            LOAD

            $(AllColumnNames)

            From $(vFullFileName)(qvd)

            where not Exists ($(vIdFieldName));

There are some tables which do not have unique keys so it fails...

what I need to do is to have a key combination to make it unique...

for example..

my table have two fields....the combination of these two fields give me unique ID

TxnId and TxnLineID

In first step we retrieve these two fields from DB...

in second step...we need to supply an unique key which sould be the combination of TxnId and TxnLineId....

it means that vIdFieldName should have something like 'TxnId' & 'TxnLineID'.

Does it mean that I should have a field which is concatenation of these two fields in both DB and QVD file or we can do something in our script to achieve this even without having the concatenation of these fields in DB and QVD?

I am not sure how to do

1 Solution

Accepted Solutions
maxgro
MVP
MVP

Not sure I understand the question

You can concat the 2 fields when you read

Temp_$(vResTable)_Incremental:

        LOAD

         TxnId & '-' & TxnLineID as Key.           // 2 of the AllColumnNames

        $(AllColumnNames);

        SQL Select $(AllColumnNames) FROM $(vResTable)

        where $(vWhereClause);

Concatenate (Temp_$(vResTable)_Incremental)

            LOAD

          TxnId & '-' & TxnLineID as Key,

            $(AllColumnNames)

            From $(vFullFileName)(qvd)

            where not Exists (Key, TxnId & '-' & TxnLineID);

drop field Key;

View solution in original post

1 Reply
maxgro
MVP
MVP

Not sure I understand the question

You can concat the 2 fields when you read

Temp_$(vResTable)_Incremental:

        LOAD

         TxnId & '-' & TxnLineID as Key.           // 2 of the AllColumnNames

        $(AllColumnNames);

        SQL Select $(AllColumnNames) FROM $(vResTable)

        where $(vWhereClause);

Concatenate (Temp_$(vResTable)_Incremental)

            LOAD

          TxnId & '-' & TxnLineID as Key,

            $(AllColumnNames)

            From $(vFullFileName)(qvd)

            where not Exists (Key, TxnId & '-' & TxnLineID);

drop field Key;