Page 1 of 1

Howto select start with letter

Posted: Fri Aug 23, 2013 10:03 pm
by mpol_ch

Hallo
I have a table with coloumn name "Periode" that contain year such 2011, 2012 and years with prefix B-2011 or W-2012.

Now I want to set a filter on coloumn "Periode" for table that should show only records which start with a letter eq. "B" oder "W". Type of Periode is VARCHAR.

Coudl you please advice where to set this filter in a best way?

Thanks

mpol_ch


Re: Howto select start with letter

Posted: Sat Aug 24, 2013 9:34 am
by danielc

If you do not mind to let user to see your filter, you can set it at [Table]->[Search]->Default Value.

Or just put it in table filter.


Re: Howto select start with letter

Posted: Sat Aug 24, 2013 6:50 pm
by mpol_ch

Hallo danielc

thanks for suggestion. Yes, I did insert the selection criteria in "Search" as default value with optin "Start with". But in this the user can still the all the option. I want to avoid the selection to appear with year such "2011 oder 2012". ...

thanks
mpol_ch


Re: Howto select start with letter

Posted: Sat Aug 24, 2013 6:59 pm
by mobhar

mpol_ch wrote:
Coudl you please advice where to set this filter in a best way?

Simply write your code in the "Recordset_Selecting" server event.

For example:
function Recordset_Selecting(&$filter) {
ew_AddFilter($filter, "Periode LIKE 'B%' OR Periode LIKE 'W%'"); // Add your own filter expression
}


Re: Howto select start with letter

Posted: Sat Aug 24, 2013 7:26 pm
by mpol_ch

Hello mobhar

thanks a lot. It is a good idea. But I still see in search field (Drop Down on same table) "Periode" the year like 2011. Allthough no results are beeing shown.

mpol_ch


Re: Howto select start with letter

Posted: Sat Aug 24, 2013 10:13 pm
by mobhar

Then simply define also your "Filter" code from the "Lookup Table" of your "Select" control under the "Fields" setup.

For example:
"Periode LIKE 'B%' OR Periode LIKE 'W%'"


Re: Howto select start with letter

Posted: Sun Aug 25, 2013 4:02 am
by mpol_ch

Hello mobhar

thanks a lot. This done the work.

mpol_ch