Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
We have build an application where we load in forecast data, so we have data till end of Dec 10. I would like to set the pages to default to the most recent actual data date so for today it would be 11th August. Any suggestions on how we do this? When we use Max date it gives us 31st Dec
Thanks
=Today()?
Jonathan
We have tried this and it gives us a date in December, which doesn't make much sense as we don't have actual data
Assuming that you have last day's data whenever reloaded, can you use 'ReloadTime()' and subtract one day from it?
Hi,
I do it this way:
1. At end of scripts, when all data has been loaded...
// Calculate Last Transaction date
LastTransDateTemp:
load distinct
max(TranDate,1) as LastTranDate
resident TransactionLines;
let vLastTransactionDate = date(peek('LastTranDate',-1,'LastTransDateTemp'));
drop table LastTransDateTemp;
2. Then I created a macro
sub StartSelection
LatestTranDate = ActiveDocument.Variables("vLastTransactionDate").GetContent.string
ActiveDocument.Fields("Year").Select Year(LatestTranDate)
ActiveDocument.Fields("Month").Select left(MonthName(Month(LatestTranDate)),3)
ActiveDocument.Fields("Day").Select Day(LatestTranDate)
end sub
3. Then in the Macro tab of the Dicument Properties, Document Event Triggers highlight 'OnOpen' and select the StartSelections macro
Note that, for my purposes, I seperate the Year, Month and Day fields. Each time I open the QlikView document it selects transactions for the latest Year, Month and Day of the available transactions
Hope this gives you some idea.
Raisin
oh this sounds like it might work. What do i need to type into the search string to let it know it needs to subtract a day is it ReloadTime(-1)
date(ReloadTime()-1,'MM/DD/YYYY')
This will give you the last day's date.
You don't need to since it uses the date of the latest transaction