Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
thomastc
Contributor III
Contributor III

Trigger OnOpen Date Range

Hello,

I am pretty sure there is a simple answer to this but I have drawn a blank!

I have two date variables populated with a Start and an End date.

What I need is the date field to be set to this date range when the document is opened.

I cannot see a way of setting a range in the Select in Field Action of the Document Event Triggers.

Any help will be appreciated!

Thanks.

1 Solution

Accepted Solutions
thomastc
Contributor III
Contributor III
Author

D'oh I knew it was going to be simple enough:

='>=' &

varStartDate & '<=' & varEndDate



Silly me.



View solution in original post

6 Replies
deepakk
Partner - Specialist III
Partner - Specialist III

HI.

Go to Document properties--> Trigger-- > OnOpen --> Add Action--> External-->Setvariable

YOu might have to do it twice to add values to from and to date

thomastc
Contributor III
Contributor III
Author

Hi,

Thanks for the reply. My issue is not setting the variables, that part is fine. Sorry if I was not clear.

My problem is applying the values of the variables to the date field when the document is opened.

For instance, I set the end date to the latest activity in the financial year (say 15/10/2010), and the start date is simply the beginning of that year (01/04/2010 for example). Now, when the document is opened, I would like the date field to be set to the range 01/04/2010 to 15/10/2009.

deepakk
Partner - Specialist III
Partner - Specialist III

hi,

Sorry its not clear. Normally we add the from date and to_date in charts .

So do u want to add it in charts ?

thomastc
Contributor III
Contributor III
Author

Hi,

The field is used all over the application.

Is there a way to make an OnOpen trigger that will set the a DateField field to a range as opposed to an individual date. Essentially I require the equivalent of:

Settings > Document Properties > Triggers > OnOpen

Action: Select in Field

Field =DateField

SerachString: =Between varStartDate AND varEndDate

So when the user opens the application the DateField will already be set to the year to date latest data.

Maybe I need a Macro for this and fire the Macro in the OnOpen trigger.

thomastc
Contributor III
Contributor III
Author

D'oh I knew it was going to be simple enough:

='>=' &

varStartDate & '<=' & varEndDate



Silly me.



devaljain5
Contributor II
Contributor II

In addition to the date range, my customer also wants to see the applications with blank date. How to achieve this?

I have tried below 2 options but they don't work:

1) ='>='&Date(vStartDate,'MM/DD/YYYY') & '<='&Date(vEndDate,'MM/DD/YYYY') & '=' & NULL()

2) ='>='&Date(vStartDate,'MM/DD/YYYY') & '<='&Date(vEndDate,'MM/DD/YYYY') & '=' & ''

 

Any suggestions?