Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I need to do the following, would appreciate any ideas about the best way to do this.
I have a Model which loads data per month. On the first run I need it to export data to qvd files per month example qvd201501.qvd, qvd201502.qvd etc.
On the second run it should only run the current month, and export to qvd, with this exception. On the 1st of May for example it still needs to run the data for April, 2nd of May it should export for May only.
Then in the actual model for the Users, I need to automatically import the last 12 month's qvds only
Sorry, been busy lately. I'll do my best.
12 months: yes you can change that. I didn't define a variable for the number of months you want to go bback because you stated that the final document will only load data from the last 12 months. Change the FOR loop start into something like:
SET vNumOfMonthsToGoBack = 24; // Now we get a run for 24 (preceding) months
FOR j = 0 TO $(vNumOfMonthsToGoBack) - 1
:
File naming: the LET statement in the FOR body assigns a different name to each successive table. If I understand it correctly, you can modify the LET statement into something like. This. Note that if you want to cover more than 12 months, you should include the year as well. That's what this LET statement does.
LET TableName = 'RE0001-$(=year(AddMonths(today(), $(j))))$(=num(Month(AddMonths(today(), $(j))), '00'))';
Resident source data: just to make my example code simpler. The LOAD is from a central RESIDENT table that contains all data. YMMV. BTW Your assumption about how it operates is correct.
Code comment 2: exactly, that's all there is to it. You create a QVD if one of these conditions is met:
Best,
Peter
Did you manage to get it to work?
Peter
Will get back to you, busy with some SQL DBA stuff as well
On Fri, May 8, 2015 at 8:33 PM, Peter Cammaert <qcwebmaster@qlikview.com>