Question

Filter Between Two Dates

  • 31 January 2021
  • 4 replies
  • 89 views

Badge +1

The ultimate goal is to be able to filter by a single date (Start Date) or by date range (between Start / End Date), and a Room Condition (Vacant Task is the name in the SmartObject) if specified. I was able to get the Room Condition to filter without any issue, however the dates are not filtering as expected. If I hard code a date in the view filter, it will work. If I pass a date from a calendar control, the filter does not filter the results.

 

The filter configuration (Left side is value being returned by the SmartObject, Right is the SmartForm control)

 

I have two views (Filter View, Worklist View)

 

I have a list item click event to show the value of the Date of Move field:

 

 

Fields available from the SmartObject:

 

Results from K2 Management when I execute the SmartObject:

 


4 replies

Userlevel 3
Badge +7

Hi @Jason_Discover,

Perhaps try transfering the date from a calendar control to another control (like a datalabel), and use that control in your filter. You can use the when a control is changed event, fllowed by either a transfer data rule or set a control’s property rule to do so.

 

Kind Regards

Prineel

Badge +1

Unfortunately, I need to filter between all of the records displayed in the list view. Otherwise, that approach would work.

Userlevel 1
Badge +3

Hi @Jason_Discover,

 

Is the data coming from SQL Server? if yes, then you can create a stored procedure where in StartDate, End Date and Room condition will be the input parameter to the stored procedure. With this you don’t have to bother about the time zone.

 

Or try to set the Calendar control style and the list column start date column in the same location.

 

BR,

Divya Raj 

Userlevel 3
Badge +7

Hi @Jason_Discover,

 

Your advanced filter configuration should be able to filter between two dates using the calendar control and your textbox control. It wont be able to filter by a single date or without anything in the texbox because you are using the “And” operator so it has to filter by using all 3 requirements/parameters. However, if it does not filter if you have all 3 controls populated, then there might be something wrong. Please let us know which version of K2 you are using.

 

Kind Regards

Prineel

Reply