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

Predefined selection based on current date

Hello!

I have three different listboxes.

Year, Month and Day.

I want the current time to be selection by default.

So when i start the application. 2014 is choosed in the year, mars i choosed in the month and all the days choosed in the day list box.

And ofcourse, i want this to be dynamic, so when April starts, i want it to select April instead.

Is this possible?

Thanks

1 Solution

Accepted Solutions
Not applicable
Author

Use Document event trigger OnOpen and use 'Select in Field' action.

Add field name and mention below expression in Search string:

=Year(Today())

Hope this helps!

View solution in original post

9 Replies
MK_QSL
MVP
MVP

Setting >> Document Properties >> Document Event Triggers >> On Open >> AddAction >>

Add >> Selection >> Select in Field >> Field = Your Date field (i.e. Date)

Search String = Today() (i.e. =Today())

The same way if you keep Field = Month

Search String =

=Month(Today())

will give you desired result..

Not applicable
Author

I added action to "OnPostReload"

Select in Field, Field =DayA and Search String =Today()

But this does not work..

MayilVahanan

HI

Try like this

Setting - Document Properties - Triggers-> Document Event Triggers - On Open

Add Action

Field      SearchString

Month    =Month(Today())

Year      =Year(Today())

Day      ='>='& Day(MonthStart(Today())) & '<=' & Day(Today())

hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Use Document event trigger OnOpen and use 'Select in Field' action.

Add field name and mention below expression in Search string:

=Year(Today())

Hope this helps!

Not applicable
Author

I just realised that i dont need to choose days.

My tables names are MonthA and YearA.

So if i can choose Mars and 2014 by default that would be great.

I want it to be selected everytime i reload the data.

Thanks

CELAMBARASAN
Partner - Champion
Partner - Champion

Use OnOpen event trigger instead of OnPostReload event trigger.

Not applicable
Author

Now i have "Select in Field"

Field =MonthA

Search String =Month(Today())

But that does not work....

Not applicable
Author

Monthnames mentioned in below SET line should match with database month.

SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';

Plz change SET statement to make all the months in sync.

CELAMBARASAN
Partner - Champion
Partner - Champion

Just want to confirm. did you used like this

For Field it is MonthA

For Search String it is =Month(Today())