Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
amit_saini
Master III
Master III

Script Help ???

Hi Folks ,

Below is my QVD Gen script , triggered on hourly basis. Currently I'm facing some issue with the data , sometimes I'm missing some data from the Stichprobe table ,so to avoid this situation what I'm looking is to recreate this qvd over the weekends for the past whole week .

STICHPROBE:

LOAD

    '$(vPlant)' as Plant,

    *;

SQL SELECT

NSPCIDNR,

NTOOLNR,

NSTPNR,

NPERS_IDNR

FROM $(vPlantAutor).STICHPROBE

WHERE DTTSERF > to_timestamp('$(vLAST_LOAD_TIME)', 'DD.MM.YYYY HH24:MI:SS');

store STICHPROBE into $(vQVDCurrentYear)\$(vPlant)_STICHPROBE.qvd;

Below is example:

Today is Monday 21st Sep , so this qvd gen will work as it is triggered currently till Friday midnight  , but on Sat or Sun what I'm looking for is to call the data from the complete week starting from 21st till 25th sep .

Please help me on this task , how can I do this by using above script.

Thanks,

AS

2 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

If I understand you right, add this line before the load

Let vLoadFrom = If(Weekday(vLAST_LOAD_TIME) >= 5, WeekStart(vLAST_LOAD_TIME), vLAST_LOAD_TIME);

And then in the load where clause, use vLoadFrom:

WHERE DTTSERF > to_timestamp('$(vLoadFrom)', 'DD.MM.YYYY HH24:MI:SS');

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
amit_saini
Master III
Master III
Author

Thanks Jonathan for the suggestion.

Thanks,

AS