sort a list on the basis of shift timings w.r.t. current time

Hi, forum, I am trying to show a list of “demouser” (in a list view on the page) on the basis of working hours of “ demouser” I have multiple attributes in the entity in which two fields are ie “StartTime”(DateTime in HH mm format) and “FinishTime”(DateTime in HH mm format)  in the “ demouser” entity. The use case is such that a user will be listed if its user working hrs are between StartTime and FinishTime wrt current time. please suggest if this is possible in this way or something else is needed to be done.  
1 answers


I think I understand your requirement.  You can use Xpath functions to accomplish this.  As a test, I created a Listview with the Xpath constraint below.  This shows all demousers for whom the Current Time is between their StartTime and FinishTime. 

[hours-from-dateTime(StartTime) <= hours-from-dateTime('[%CurrentDateTime%]')
minutes-from-dateTime(StartTime) <=  minutes-from-dateTime('[%CurrentDateTime%]')
hours-from-dateTime(FinishTime >= hours-from-dateTime('[%CurrentDateTime%]')
minutes-from-dateTime(FinishTime) >= minutes-from-dateTime('[%CurrentDateTime%]')]

I am not sure if this is exactly your use case, but if not, perhaps this example will give you a starting point.

Hope that helps,