This topic is locked
[SOLVED]

 Add custom field in advanced search PHP Runner

4/29/2015 10:47:00 PM
PHPRunner General questions
L
lmb_hs_sp author

I want to add a custom field in advanced search page, take the value of it and process it in SQL query. I get how to add a custom field in Visual Editor but I struggle to get the value of that field in Before SQL query of search result page (List page).
I have tried this http://xlinesoft.com/phprunner/docs/add_custom_field_to_form.htm

But it does not work. I assume it is only for Add/Edit page. My custom field is in Search page.
The reason I want to add a custom field in search page is this: the list has a date field and in the advanced search, we can only search by exact date. I want to make it searchable by date range. I will add start date and end date fields to the search parameters and modify the SQL query to get all the dates fall within this range.
If I am doing it wrong completely, please show me the right direction. My PHP Runner version is PHPRunner Enterprise 8.0 (Build 23092). I might, for some reason, use another version of PHP Runner (v6.2) to recompile it in the future though.
Thanks.

admin 4/29/2015

I'm not quite sure why cannot you use 'Between' option to search for a date range?
Anyway, you can simply add a dummy calculated field to your SQL query i.e.

select ...,

'' as newfield

from ...


'Newfield' will appear on Advanced Search page. You will have to modify SQL query on the fly and that can be complicated. Using 'Between' option you can achieve the same thing without much effort.

L
lmb_hs_sp author 5/3/2015

Where is this "Between" option located?
Actually what I am trying to do is a little more complicated than what I explained earlier. I have 2 date fields says check in and check out dates. In the search page, only one date range will be shown. Users will use the date range to search all the checked in customers who are not checked out. There are several business conditions involved in this operation.
So I think modifying SQL WHERE condition is the best way to do it. Or any other way to do it?
Thanks.

admin 5/4/2015

'Between' is one of the search options. On each advanced search page there is a dropdown box with search options like Equals, Between etc.
If you are looking for something that is more complicated you can modify SQL Query on the fly. Take a look at this:

http://xlinesoft.com/phprunner/docs/modify_sql_query_on_the_fly.htm