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: 
yacine_b
Contributor III
Contributor III

Script condition; keeping current data in the document

Hi,

I need to create a condition in the script;

If the result was true, load data from database

Else, keep the current data in the document.

The script could be like the following:

If <CONDITION> then

Load … from ...

Else

// keep current data in the document

End if

Could you help me please to create this script?

Regards,

Yacine





1 Solution

Accepted Solutions
yacine_b
Contributor III
Contributor III
Author

I found the solution.

I added "Binary <the current document path>" in the top of the script

That's all



View solution in original post

2 Replies
yacine_b
Contributor III
Contributor III
Author

I found the solution.

I added "Binary <the current document path>" in the top of the script

That's all



prieper
Master II
Master II

But this has nothing to do with your first query?

Your approach to the script is correct, as conditions you may hardcode a certain age of the file to read, or number of records. You may also store the filetime of the last load into a variable and then do the comparison to find out, whether the current file is newer.
The ELSE-condition may also contain an EXIT SCRIPT - thus no refresh.

Your code then may look like

LET sFile = 'YourFile';
IF dLastFileDate < FILETIME($(sFile)) THEN
LOAD * FROM $(sFile);
ELSE
EXIT SCRIPT;
END IF;
LET dLastFileDate = FILETIME($(sFile));


HTH
Peter