This topic is locked

Searching periods

2/28/2014 5:41:21 AM
PHPRunner General questions
S
sgchan author

Hi, I have a Period field which represents month-year in <mm>/<yyyy> format. But the data is represented as <yyyy><mm> in the database itself (so it is an integer). I use the Before Save event to change the format from <mm>/<yyyy> to <yyyy><mm> before saving into the database.
The question is, how do I do this same period format conversion when I search in the Panel as well as in Advance Search?
Many thanks in advance.

Sergey Kornilov admin 2/28/2014

One thing is not clear - how users enter search data into this field on search panel? Do they enter it manually as yyyymm?

S
sgchan author 2/28/2014



One thing is not clear - how users enter search data into this field on search panel? Do they enter it manually as yyyymm?



Hi Sergey, I'd like the users to enter as <mm>/<yyyy> but the system will convert that into <yyyy><mm>. Is this possible?

Sergey Kornilov admin 2/28/2014

It's possible but it will not be easy. Quite a bit of custom coding will be required and we do not have sample code for this task.
It will be much easier and straightforward if your users enter search data in the same format as it appears in the database. Another option - create two separate search fields for year and month selection. Can be dropdown boxes or regular text boxes.