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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
matt_crowther
Specialist
Specialist

Load if number of dates are present against expected value.

I hope someone can advise:

I'm attempting to create a load script that will only run once a certain number of .daily qvd files are present. So far I have a .qvw scheduled to reload on the 1st of each month (via QVS); it pulls in a 'System Activity Calendar' and determines how many distinct dates it should be expecting in the concatenated daily .qvd's for the previous month. Essentially what I want to do is: load the calendar and get the required number of days (I can do this), load and concatenate all the daily .qvd's for the previous (I can do this) but then only reload the daily .qvd's if the number of distinct dates equals the number expected from the System Activity Calendar - this is because the daily reload system may have failed resulting in missing data, if the condition isn't met a Msg box / email alert will be raised.

I've tried doing this via variables and an 'If…Then…Else' in the load script but of course aggregations via 'Count' and 'Sum' won't work.

Any guidance much appreciated.

1 Reply
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Do the aggregations via a LOAD statement. Then put the aggregated fields into variables and use the variable in the If/Then/Else. Something like this.

LOAD count(DISTINCT TranDate) as TranDateCount
RESIDENT foo;

LET vTranDateCount = peek('TranDateCount');

IF $(vTranDateCount) < 31 THEN
exit script
END IF

-Rob