Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Sayjir
Contributor II
Contributor II

Date is not appearing as date field in datepicker

Hello all,

i want to use the datepicker, but nothing is appearing as datefield. 

start and endate are saved like this in the database: 2021-07-13 11:03:58

I'm loading my data like this in Qlik: 

LOAD id,
username,
Date(enddate) as EndDate,
Date(startdate) As StartData,
interval(enddate-startdate) as Duration;

[runs]:
SELECT id,
startdate,
enddate,
username,
FROM `database`.runs;

Unfortunately there is no value to select in the datepicker. i guess the startdate and endate are not recognized as date.

Can someone help me?

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

 

First, you will want to remove the time portion when loading and keep only the date portion. Do that using Floor().

Date(Floor(enddate)) as EndDate,

Make sure your dates are being interpreted properly as dates.  Put the field in a filter box with the expression
=Num(EndDate)

It should show as a number like 44321. If not, you will need to use an interpretation# function when loading. 

Date(Floor(TimeStamp#(enddate, 'YYYY-MM-DD hh:mm:ss'))) as EndDate,

If EndDate still does not appear in the DatePicker, check the tags assigned to the field. You can see the tags in the data model viewer Preview area after selecting the field. It's the "$date" tag that causes the field to appear in the DatePicker dropdown.  I have seen recent cases where the $date is not getting assigned. The workaround is to force the tag in your script. Add this to the end of the script. 

Tag Field EndDate with '$date';

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

View solution in original post

2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

 

First, you will want to remove the time portion when loading and keep only the date portion. Do that using Floor().

Date(Floor(enddate)) as EndDate,

Make sure your dates are being interpreted properly as dates.  Put the field in a filter box with the expression
=Num(EndDate)

It should show as a number like 44321. If not, you will need to use an interpretation# function when loading. 

Date(Floor(TimeStamp#(enddate, 'YYYY-MM-DD hh:mm:ss'))) as EndDate,

If EndDate still does not appear in the DatePicker, check the tags assigned to the field. You can see the tags in the data model viewer Preview area after selecting the field. It's the "$date" tag that causes the field to appear in the DatePicker dropdown.  I have seen recent cases where the $date is not getting assigned. The workaround is to force the tag in your script. Add this to the end of the script. 

Tag Field EndDate with '$date';

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

Sayjir
Contributor II
Contributor II
Author

Thanks a lot! 

Date(Floor(enddate)) as EndDate was the solution