Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
sridhar_sigired
Creator
Creator

Full load and incremental load based on variable

Hi,

I have a incremental code with variables.

IF $(vLoadType) = 0 THEN  // FULL DATA LOAD

///Code

ELSEIF $(vLoadType) = 1 THEN  // INCREAMENTAL LOAD

///Code

ENDIF;

So, whenever i want to do full load, i need to pass 0 for parameter value in QMC and incremental load need to change it to 1.

Instead of that i want to write a logic in QVW, where if particular full QVD is available in folder then, variable value should set as 1 for incremental load, otherwise it should go for full load.

Can any one help me to write a logic in generator, instead of manual parameter change at QMC?

Thanks for your help.

Regards,

Sridhar

15 Replies
MK_QSL
MVP
MVP

No... you have to do one qvd at a time..

sridhar_sigired
Creator
Creator
Author

Unfortunately i have three facts within a generator, is there any other way we can do?

sridhar_sigired
Creator
Creator
Author

Can anyone help me on this please ?

marcus_malinow
Partner - Specialist III
Partner - Specialist III

Sridhar,

a possible solution:

IF (isNull(qvdCreateTime('..\QVDData\Fact_Table.qvd'))) THEN

  //Full load script for Fact_Table

 

ELSE

  //Incremental load script for Fact_Table

ENDIF;

IF (isNull(qvdCreateTime('..\QVDData\Fact_Table2.qvd'))) THEN

  //Full load script for Fact_Table2

 

ELSE

  //Incremental load script for Fact_Table2

ENDIF;

chriscammers
Partner - Specialist
Partner - Specialist

You Could load just the xml header from the files in question and then analyze whatever conditons you need.

You'll notice a couple of functions that give you information about the file, these are read from the filesystem and you are not actually opening the file, so depending on the size of your fact tables you may want to skip reading the xml header.

T:

Load * inline [

Foo,Bar

1,2

3,4

2,5

3,6

6,7

4,8

4,7

9,4

6,8

9,3

];

//this is an example so I'm faking the files, sleep is just making sure the create times on the file are not the same.

Store T into file1.qvd(qvd);

Sleep 10000;

Store T into file2.qvd(qvd);

Sleep 10000;

Store T into file3.qvd(qvd);

For Each file in 'file1.qvd','file2.qvd','file3.qvd';

  Files:

  LOAD

     filetime() as FileUpdateTime,

     FileName() as FileName,

     FilePath() as Path,

     QvBuildNo,

    CreatorDoc,

    CreateUtcTime,

    ConvertToLocalTime(CreateUtcTime,'Central Time (US & Canada)') as LocalTime,

    SourceFileSize,

    TableName,

    RecordByteSize,

    NoOfRecords,

    Offset,

    Length

    //%Key_QvdTableHeader_B94FCCAC68ED3E20    // Key for this table: QvdTableHeader

  FROM [$(file)] (XmlSimple, Table is [QvdTableHeader]);

  // End of [file1.qvd] LOAD statements

next

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Do you want to test if all three files exist, and if so do incremental logic? If only two files exist you want to do full reload for all three?

-Rob