Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
AndyC
Contributor III
Contributor III

Function to generate Dynamic Values for Sheet On Select Trigger?

Greetings 'Hive Mind'

I have been bashing my head against this particular brick wall all afternoon!

I want to select a number of year /periods when I activate a particular sheet in Qlikview.

I am trying something like this:

=Text(Num(Year(Today()),'0000')) & '-' & Text(Num(Month(Today()),'00'))
& ' or ' &
Text(Num(Year(Today()),'0000')) & '-' & Text(Num(MonthStart(Today())-1,'00'))

Selecting a single value works fine (i.e. the top line) but I can't seem to work out the correct syntax to pass multiple values - Help!

 

4 Replies
Brett_Bleess
Former Employee
Former Employee

Try the Toggle Select Action, believe that should likely let you do what you need to do here.

https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/Button2.htm#anc...

The Actions are documented in the Button object, but they are available to be called from the triggers as well...

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
AndyC
Contributor III
Contributor III
Author

@Brett_Bleess  

This is what I have been using but I can't seem to get the syntax of the formula right to select the field using the calculated values

 

 

AndyC
Contributor III
Contributor III
Author

What I am trying to do is the programmatic equivalent of this....

AndyC_0-1590737030867.png

 

I have the formula to calculate the necessary values but I don't know how to incorporate it into the trigger action 

😟

marcus_sommer

Try it with an approach like this one:

($(=date(today(), 'YYYY-MM'))|$(=date(addmonths(today(), -1), 'YYYY-MM')))

Helpful might be also to store the values of the current/last period within variables and use them for the selection.

An alternatively could be to select the wanted values through a numerical comparison, like:

>=$(=monthstart(today(), -1))

if there are no future dates and with them it could be look like:

>=$(=monthstart(today(), -1))<=$(=monthsend(today(), 0))

Similar numerical selections could be also done with numerical period-fields and/or running period-counters.

- Marcus