Solved

Can we filter List view based on Calendar Control?

  • 3 June 2016
  • 1 reply
  • 14 views

Badge +1

I am building small application to keep track on contractors hours. I have already built Entry form  ( Item Form) and Display Form( View Form).

View Item Form is only set up for Weekly view. You can only add hours for this week.

 

Now i want to add funcationality to allow users to go back a week and edit the entries they made.

For that i have added Previous Week Button :

10922iF055C7F3426C76B8.png

Can can i add Calendar control to allow them to filter item for previous week.

 

What would be a right approach to do this?

 

Thank you

 

icon

Best answer by RaymondJVR 31 July 2018, 12:18

View original

1 reply

Userlevel 4
Badge +13

Good Day Npokhrel


 


Based on your explanation and scrrenshot it looks like you want the result to be displayed in a list view. I would suggest that you ensure you add a property to your SmartObject which needs to be allocated for the date a new record was added, so each record would have a created date appended to it. This way you can simply recall the "GetList" method for the SmartObject, add some filters to the GetList methods rule and it would reload your list view displaying only the date for the previous week. The same can be done to go back to the current week or to go to the next week. For more detailed steps, please see the below.


Steps:
1) Create the SmartObject with the required properties, Ensure that one of those properties is "Create Date", this property should have a Data Type of "Date".

You can do the same on the GetList method which can be located in Inititialize rule to allow the view to load with the current weeks records only. 

*Important Note: This example used static values purely for explanation purposes. Depending on your requirements and your design you might need to design a expression thatn can be used in step 5 (Example: "If [Create Date] is [Greater than] [Your Expression] AND [Create Date] is [Less Than Equal] to [Your Expression]").


 


To allow the user to go back further than one week, now that would be a little more work as you would need to build an expression that needs to check which week you are currently in based on the creation date of the currently visible record, from that result you can then call the GetList method and use the result to filter the GetList method which ultimitely would re-load the view with the previous week, and the one before that, an before that respectively everytime the "previous week button is clicked".


 


Should you feel that this post is of use and or an accurate solution to the raised question, I kindly encourage you to mark it as such using the 'Mark as Solution', 'Kudo' andor ‘Me Too’ options.


 


Kind Regards


Raymond

Reply