Search for time of a DateTime-field with SimpleSearch-API

Forum to discuss the new web client version of Servoy.

Search for time of a DateTime-field with SimpleSearch-API

Postby rph » Tue Jul 13, 2021 10:46 am

Hi

Just another wish from one of our customers concerning the SimpleSearch-API:

We store usually DateTime-stuff in the database as one DateTime-Field (so the date and the time are in the same field). Now our customer wish to search for entries that have for example starttime "08:15". Is there a way to achieve this with the SimpleSearch-API. I know that you can add there alternative date-formats, but it is not possible to add only the time-portion.

Thanks for any suggestions.

Best
Roland
rph
 
Posts: 89
Joined: Wed Aug 10, 2011 11:44 am
Location: Cham, Switzerland

Re: Search for time of a DateTime-field with SimpleSearch-AP

Postby sean » Tue Jul 13, 2021 5:08 pm

Hi Roland,

Thanks for using the SvySearch extension.

What would the user actually expect in this case? For example, if they enter "8:15" ?

Any date but with exactly the time "8:15"
or today's date with that time
or some specified date which is already known somehow?

What about special operators? i.e. ">8:15"
should it be limited to entries after that time but for a single day ? or really anytime afterward ?

The expectation would be ambiguous. What is your exact use case ?

Best,
Sean
Software Engineer
Servoy USA
sean
 
Posts: 380
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Re: Search for time of a DateTime-field with SimpleSearch-AP

Postby rph » Tue Jul 13, 2021 6:09 pm

Hi Sean

Thanks for your reply.

The expectation of the user, if he enters "8:15" would be to find every record that has time-portion "08:15" regardless of the date (today, last christmas, what ever). So it should do a "string"-search. Of course, ">8:15" would not work in this case.

So, in some cases we split this in two separate fields: one with the date and one with the time as string (5 characters long). When we then show these fields in a grid-component and let the user search for "8:15", he get what he expects: every record with time "08:15" because we have a string-search.

If we put these 2 values in one date-field in the database but show these in two separate colums with this date-field in the data-grid but in one it has just the date-part and in the second column just the time part, the user will have no result, if he searches for "8:15". For the user the data-grid looks exactly the same but he has differen results.

So maybe the solution would be, to define an additional date-format for the search in such a field that makes just a formated date-string and the search will then make a string-search on that.

Hope I could explain it a little bit clearer.

Best
Roland
rph
 
Posts: 89
Joined: Wed Aug 10, 2011 11:44 am
Location: Cham, Switzerland

Re: Search for time of a DateTime-field with SimpleSearch-AP

Postby sean » Tue Jul 13, 2021 6:39 pm

Thanks for the explanation. I created a support case and we can take a closer look:
https://support.servoy.com/browse/SVYX-269

But I'm not sure that it could even be implemented and could have unintended consequences.
Software Engineer
Servoy USA
sean
 
Posts: 380
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Re: Search for time of a DateTime-field with SimpleSearch-AP

Postby rph » Wed Jul 14, 2021 9:06 am

Thank you, Sean!
rph
 
Posts: 89
Joined: Wed Aug 10, 2011 11:44 am
Location: Cham, Switzerland


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 2 guests

cron