Howto select start with letter

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
mpol_ch
User
Posts: 877
Location: Switzerland

Howto select start with letter

Post 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


danielc
User
Posts: 1601

Post 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.


mpol_ch
User
Posts: 877
Location: Switzerland

Post 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


mobhar
User
Posts: 11790

Post 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
}


mpol_ch
User
Posts: 877
Location: Switzerland

Post 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


mobhar
User
Posts: 11790

Post 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%'"


mpol_ch
User
Posts: 877
Location: Switzerland

Post by mpol_ch »

Hello mobhar

thanks a lot. This done the work.

mpol_ch


Post Reply