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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
joggiek
Partner - Contributor III
Partner - Contributor III

Selecting highest value in list box as default

Hi,

I am using gauges with reference lines in my application (% target completion at a certain date)

I list all the dates in a list box, but if more than 1 date is available or selected then the reference line don't show

The dates are all for the start of a week, so typically I will have 52 dates in the list

My fin year starts in April, so I have 3 dates available in the list, if I select any one of these dates, my reference line moves accordingly, but if I select no dates the the reference line disapear.

My question is: How can I select the latest or last date in the listbox by default?

Thanks

3 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You can try adding a Select in Field action to the OnOpen document trigger (on the Triggers tab of the document properties window). The field is your date field, the search string is: max({1} yourdatefieldhere )


talk is cheap, supply exceeds demand
Not applicable

You could also use the FirstSortedValue() function in the expression for the reference line. Basically if you do FirstSortedValue(VALUE,-DATE). The function will select the corresponding value for the maximum date.

joggiek
Partner - Contributor III
Partner - Contributor III
Author

Thank you for the advice.

What I did not mention was that there are 4 years of dates for budgets, but they are unavailable (Gray), when I use the Trigger method it selects a date from 2018, even though it is grayed out...

I will try to get the FirstSortedValue syntax to work next

Thanks