Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ambasadorknz
Contributor II
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
tresesco
MVP
MVP

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

rahulpawarb
Specialist III
Specialist III

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

Anil_Babu_Samineni

May be this?

LET vNew = Date(Today());

If vA = 5 THEN

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

ELSE

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

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
ambasadorknz
Contributor II
Contributor II
Author

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

Miguel_Angel_Baeyens

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
Contributor II
Contributor II
Author

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

Miguel_Angel_Baeyens

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

ambasadorknz
Contributor II
Contributor II
Author

load statement is correct

table isnt empty

Example below

Miguel_Angel_Baeyens

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)