Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Selecting Time Period In Sheet Trigger

Hi

When opening a sheet I want to be able to automatically select each month from Jan (as in my field called MonthName) to the current month.  The current month is easy enough but how do I get the selection to include any month from Jan up to the current month?

Many thanks for any assistance.

1 Solution

Accepted Solutions
Not applicable
Author

Hi

Extremely helpful, thank you although perhaps you could clear something up for me.  I had used a Select In Field  trigger which I placed after the run macro trigger (because I noticed it had the Activedocument.clear statement).  This had worked before I introduced the run macro trigger but afterwards didn't!  I got around it by adding an extra line to the macro.  Does a run Macro trigger limit your other trigger options?

View solution in original post

6 Replies
alexandros17
Partner - Champion III
Partner - Champion III

add to your calendar or to your table (starting from a date) the month information in numerica format so if you have for example invoice date if you do month(invoice date) you will have numbers from 1 to 12

at this point with a trigger instead of writeing month = month(Today()) just write month <= mnth(today())

let me know

Not applicable
Author

Hi

Thanks but when I enter this is the expression it will not accept <= . If I use = the syntax is OK but not <=

Many Thanks

jduenyas
Specialist
Specialist

In the sheets properties > Triggers > OnActivateSheet Click Edit actions and click Add

in Action Type select "Selections" and in Actions select "Select in Field", click OK In Field enter you Field name and in Search String enter = Month(Today())

Now each time the sheet is activated it will select the current month.

Hope it helps

jduenyas
Specialist
Specialist

Gareth, Sorry I did not read your question thoroughly, You are looking to select a range of months not just the current month.

You will need to build a Macro and call the macro from the OnActivateSheet trigger.

If you are familiar with Macros you will probably find your way if not and you need help I can attach script that will do that for you.

jduenyas
Specialist
Specialist

The attached is a sample.

Select Sheet1 and the months will be selected.

(Note that in the code I have specified to select all months EXCEPT for current month. You can modify that in the VB Code)

If this is what you are after and it serves well, click correct answer.

Not applicable
Author

Hi

Extremely helpful, thank you although perhaps you could clear something up for me.  I had used a Select In Field  trigger which I placed after the run macro trigger (because I noticed it had the Activedocument.clear statement).  This had worked before I introduced the run macro trigger but afterwards didn't!  I got around it by adding an extra line to the macro.  Does a run Macro trigger limit your other trigger options?