Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
BARC’s The BI Survey 19 makes it official. BI users love Qlik. GET REPORT
ambasadorknz
New Contributor II

Reload old data in script

Hi,

I have problem with reload old data in script.

I want check some condition and if it`s true then load table from database but if it`s false then reload old data...

Example:)

If vA=5 then

Load

...

else

Reload Old Data;

Is it possible? Any Idea?

10 Replies
MVP
MVP

Re: Reload old data in script

Yes possible. Have you tried? Is there any issues you are facing?

rahulpawarb
Valued Contributor III

Re: Reload old data in script

Yes it is possible; you can make use of below sample code snippet:

if $(vLoadOldData) <> 0 then

Table1:

LOAD *

FROM Old.qvd(QVD);

ELSE

Table1:

LOAD *

FROM New.qvd(QVD);

ENDIF

Hope this will be helpful.

Regards!

Rahul Pawar

Re: Reload old data in script

May be this?

LET vNew = Date(Today());

If vA = 5 THEN

Load * From Table where PrimaryKey >= '$(vNew)';

ELSE

Load * From Table Where PrimaryKey <= '$(vNew)';

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
ambasadorknz
New Contributor II

Re: Reload old data in script

I should trace each table to reload old data??


Olik doesn`t have more simply way to solve this problem ( some function like exit stript etc....)??




If vA=5 then

// reload by new data

Table1:

Load from dbo.orders;

Table2:

Load from dbo.Clients;

else

// reload by old data

Table1

Load from //filepath/report_name.qvd(QVD);

Table2:

Load from //filepath/report_name.qvd(QVD);

ENDIF

Re: Reload old data in script

Yes it does, EXIT SCRIPT is the syntax. When this statement is read, the script finishes. See here for further reference and options to use WHEN or UNLESS along with EXIT SCRIPT:

Exit script ‒ QlikView

Actually your code is quite similar to an actual QlikView script, and can be further refined to cover more cases.

ambasadorknz
New Contributor II

Re: Reload old data in script

When i use Exit Script Table1 and Table2 are empty... but i need old data in Table1 and Table2.

Re: Reload old data in script

Perhaps your load statements are not correct or the tables or files empty?

ambasadorknz
New Contributor II

Re: Reload old data in script

load statement is correct

table isnt empty

Example below

Re: Reload old data in script

In the ELSE you only have EXIT SCRIPT; if you still want the old data you will need to load it there, otherwise if minute is less than 30 then the script does nothing (exits)