Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Incremental load query

Hi Guys,

Can anyone help me understand if below logic is for insert only or insert and update?what this logic is doing?I am struggling to understand this logic.Please help me

For Each v_File in FileList('$(FicSRC_ExportQueries_4)*_RSS_EXP_QUERY_4_*.csv');

Let v_File_HoroDate = left(TextBetween('$(v_File)','_RSS_EXP_QUERY_4_','.csv'),8);

IF (isNull(qvdCreateTime('$(RootDir_FACT)RSS_RETURN_CANCELATION_QUERY_4_$(v_File_HoroDate).qvd'))) THEN

// Si il n'existe pas on ajoute la date dans la list à traiter

List_RSS_RETURN_CANCELATION_QUERY_Date_To_Build:

LOAD '$(v_File_HoroDate)' as RSS_RETURN_CANCELATION_QUERY_Date_To_Build

AutoGenerate 1;

END IF

NEXT v_File

Let a = NoOfRows('List_RSS_RETURN_CANCELATION_QUERY_Date_To_Build');

let l_Date_idx=1;

Do while len(fieldvalue('RSS_RETURN_CANCELATION_QUERY_Date_To_Build',l_Date_idx))

let l_Date=fieldvalue('RSS_RETURN_CANCELATION_QUERY_Date_To_Build',l_Date_idx);

TRACE $(l_Date);

RSS_RETURN_CANCELATION_QUERY:

LOAD

ID As [ID],

REPORTING_UNIT,

STATUS,

REQUEST_TYPE,

REQUESTER_NAME,

CANCELATION_REASON as CANCELATION_REASON_ID

    FROM

[$(FicSRC_ExportQueries_4)*RSS_EXP_QUERY_4_*$(l_Date)*.csv]

(txt, codepage is 1252, embedded labels, delimiter is ';', no quotes);

STORE RSS_RETURN_CANCELATION_QUERY into '$(RootDir_FACT)RSS_RETURN_CANCELATION_QUERY_4_$(l_Date).qvd';

DROP Table RSS_RETURN_CANCELATION_QUERY;

let l_Date_idx=l_Date_idx+1;

LOOP

// On test si le QVD Global existe

IF (Not isNull(qvdCreateTime('$(RootDir_QLIKMART)RSS_RETURN_CANCELATION_QUERY_4.qvd'))) THEN

Let l_test = 'Not IsNull($(a))';

Else

Let l_test = '1=1';

ENDIF;

IF $(l_test) THEN

// On concataine tous les QVD FIRSTDATE en supprimant les doublons

RSS_RETURN_CANCELATION_QUERY_ALL:

LOAD

*

From '$(v_DestinationPath)RSS_RETURN_CANCELATION_QUERY_4_*.qvd' (qvd)

Where not Exists([ID]);

STORE RSS_RETURN_CANCELATION_QUERY_ALL into $(RootDir_QLIKMART)RSS_RETURN_CANCELATION_QUERY_4.qvd;

DROP Table RSS_RETURN_CANCELATION_QUERY_ALL;

ENDIF;

1 Reply
Miguel_Angel_Baeyens

It loads several CSV files from a folder and stores them into QVD files, then loads from the QVDs those for which the field ID has not been already loaded.

I would recommend you to use EXIT SCRIPT; after each block of code so you can see, step by step and without breaking anything, how the script works and what it does. Debugging and clicking on Step instead of Run also helps to see the values of the variables and how each instruction is called.