Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
Contributor III
Contributor III

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
Highlighted
Contributor III
Contributor III

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

Highlighted
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