Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help with trigger to show the future data by default.

Hi All

I have a pivot table which shows the data from start of the year to the end of the year. What I need is this chart by default it should show the future data only.(i,e) DateField >= today(). May I know how to achieve this with the help of trigger?

Thanks

Attitude

4 Replies
swuehl
MVP
MVP

I think you could use a trigger on opening of the document (see document properties trigger) or OnActivateSheet (see sheet properties) to set the DateField to today's date.

For example, go to document properties, triggers. Select an OnOpen event trigger with action Select - Select in field.

use

DateField

as field (as is, no equal sign), and

='=sum({<Date = {">=$(=today())"}>}1)'

as search expression.

This will affect all objects that are affected by DateField.

Or you make use of a set of additional variables / data island field, with two states: default (today), free selection and use these states within your pivot table object to limit your DateField if requested. Like above, the trigger would set the state to default on Opening of document or activation of sheet.

Not applicable
Author

Hi

I tried with the solution that you have provided but it didn't workout. Can you please provide some other solution.

Thanks

Attitude

swuehl
MVP
MVP

Which solution have you tried out? Since I think the solution does work, it would be nice if you could give some more information about what you tried.

Attached a demo of the OnOpen document trigger and selecting the dates >= today.

I think it works, doesn't it?

Stefan

(To demonstrate it, clear selection, save and close the app, start the app).

Anonymous
Not applicable
Author

swuehl solution should work, but only if your Date field has the the same format as the trigger.

To make sure that your date-field always is the same format as the expression you want to compair (or calculate) with. Best way to know this is to make 2 text object.

Text object one:

          =Today()

Text object two:

          =MAX(Datefield)

If the results have not the same formats it will not work.