Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Guys,
I need to select the last two years as default selection. If anybody knows the syntax I would appreciate.
Thanks,
Nima
If you are talking about default selection, you are talking about setting these values on opening the document or when you enter a sheet, something like that?
You can use actions triggered by some event to achieve what I think you want.
For example, create a button with action Selection - Select in Field.
Then enter
Year
as field name, or however your Year fieldname is (but without equal sign or single quotes, just the name)
and as search expression:
='=sum({<Years = {">$(=max(Years)-2)"}>} 1)'
A click on the button should select last two years, please see attached demo.
If this works, you can use any appropriately triggered action e.g. under document properties -Triggers - OnOpen event, to have this done automatically.
Hope this helps,
Stefan
If you are talking about default selection, you are talking about setting these values on opening the document or when you enter a sheet, something like that?
You can use actions triggered by some event to achieve what I think you want.
For example, create a button with action Selection - Select in Field.
Then enter
Year
as field name, or however your Year fieldname is (but without equal sign or single quotes, just the name)
and as search expression:
='=sum({<Years = {">$(=max(Years)-2)"}>} 1)'
A click on the button should select last two years, please see attached demo.
If this works, you can use any appropriately triggered action e.g. under document properties -Triggers - OnOpen event, to have this done automatically.
Hope this helps,
Stefan
Thanks a lot , it works.
Hello Stefan,
I can perfectly adopt your suggestion for a default selection in my application. Thanks!
Although it works, I didn't got through why it works yet. Would you mind explaining what does the "='=" stands for?
Regards,
Thomas
Thomas,
you need to look out for the second single quote at the very end, it's a string, like
='AdvancedSearchExpressionString'
where the advanced search expression is
=sum(....)
Don't ask me why we need to enclose an advanced search expression in single quotes with a preceding equal sign when used in a selection action. IMHO search expressions are probably the worst documented part of QV I know of.
Regards,
Stefan