Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
stekol61
Creator
Creator

Vizlib default date

Hi!

I use the Vizlib calendar extension in an app.

I want the app when open to present data for the previous 5 days .

I use the "Initial Selection" and can set a "Initial Start Date".

What should the formula be in order to present the previous 5 days?

25 Replies
stekol61
Creator
Creator
Author

Hi!

I've try that but the selected range is removed when the app is closed and opened again

groveliam
Creator
Creator

Did you try the extension I attached? The vizlib filter doesn't help this problem, but the Simple field select does.

stekol61
Creator
Creator
Author

Hi!

What should the expression look like in 'Simple field select' -> 'Select this one as default'?

anguila
Partner - Creator
Partner - Creator

Hi Stefan,

As it's an extension, this is only applied on a sheet level, so it will only apply the selection if the sheet it's opened.

Same would happen with the vizlib filter (which has a similar option), or any other extension really.

Cheers,

David

stekol61
Creator
Creator
Author

Hi!

The sheet has a table that contains data for several weeks. When the app is opened i want to present data for e.g. only the previous 5 days.

If it's possible to do this without using the Wizlib Filter or Calendar it's OK with me.

I need to have a filter since the user should have the possibility to select another date range when they are working with the app.

anguila
Partner - Creator
Partner - Creator

You can certainly do that using the vizlib filter with:2018-08-23_12-48-46.png

If you want to select the last 5 days, just convert that expression into the comma separated dates you'd like to select for the user using Qlik Expressions.

I hope this helps,

David

stekol61
Creator
Creator
Author

Hi!

Isn't this hard coded dates?

What I need is that it always should show the previous 5 days. I.e  5 days back from the date when the app is opened

anguila
Partner - Creator
Partner - Creator

Hi Stefan,

If you want to select the last 5 days, just convert that expression into the comma separated dates you'd like to select for the user using Qlik Expressions.

You'll have to calculate those dates there, there multiple ways to do it, ie: using concat()

Best,

David

stekol61
Creator
Creator
Author

Hi!

I don't want to select the last 5 days manually.

I need an expression that always calculates the previous 5 days.

E.g. today (2018-08-23) the result should be 2018-08-22  ->08-18.

Tomorrow the result should be 2018-08-23  ->08-19

groveliam
Creator
Creator

Try creating variables like

d1 = Date(max(dateField), 'YYYY-MM-DD')

d2 = Date(max(dateField)-1, 'YYYY-MM-DD')

d3 = Date(max(dateField)-2, 'YYYY-MM-DD')

d4 = Date(max(dateField)-3, 'YYYY-MM-DD')

d5 = Date(max(dateField)-4, 'YYYY-MM-DD')

and then use David's format and put:

'd1,d2,d3,d4,d5'

or

'$(d1),$(d2),$(d3),$(d4),$(d5)'