Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Announcements
BARC’s The BI Survey 19 makes it official. BI users love Qlik. GET REPORT
Highlighted
Partner
Partner

OnOpen trigger: select max date from field

Hi everybody!

I want that everytime I open my dashboard, the more recent date is selected. The field i want this date is selected is named '-MonthYearMC', the format of the date of this field is 'MMM YY'.

I try in document properties>triggers>OnOpen>Select in field. but i have no luck .

I'll attach the script of the master calendar where my field is created.

Hope you could help me, thanks in advance.

PS: Have in mind that the date is always updating with more recent data.

 

2 Replies
Support
Support

Re: OnOpen trigger: select max date from field

Sofia, I need a little more information here in order to try to figure out if there is something we can do here.  I did want to point out to you that the OnOpen trigger is an unsupported trigger in the Ajax Client, this is documented in the following Help link:

https://help.qlik.com/en-US/qlikview/November2018/Subsystems/Client/Content/QV_QlikView/Document_Pro...

Just off the top of my head, I am thinking the better way to go at this may be to set a variable in the script and then use the variable to set the date etc...  My post will kick this back up in the list, so someone else may have something better, but I think that is going to potentially be the better way to go here, but I do not have an example for you.  If you have not searched the prior posts, you may want to do that, as I am pretty sure there are other posts out there along these lines too.  I would do it for you, but you know your use case better than do I, so I will let you have a look to see what you can find, and if you do find something but have further questions, just post that link back here and pose your question and hopefully one of can try to help you further.

Regards,
Brett

To help users find verified answers, please don't forget to use the "Accept as Solution" button on any posts that helped you resolve your problem or question.
johncaqc
Valued Contributor

Re: OnOpen trigger: select max date from field

In as much as your field is text will do that:

Month(TempDate) &' '& Right((Year(TempDate)),2) AS[-MonthYearMC]

I would suggest instead creating the field in this manner:

Date(Floor(TempDate),'MMM YY') as [-MonthYearMC]

This will retain a numerical value and should fix your issue.

V/r,

John