Topic: Search result with first letter in a name?

How do I configure my search field to be able to list a result with maybe one or two letters entered in the search field?

For example. If I put in just a letter "A" in the search field and press the search button. I want the table to show all names starting with A. As it is now I have to enter the whole name to display it in the search field. Entering just the first letter or perhaps two, result in a blank table.

Re: Search result with first letter in a name?

Filter %s%

Domebil

Re: Search result with first letter in a name?

SupaBeast
Component TextBox has property "Filter" set its value to %s%

Dmitry.

Re: Search result with first letter in a name?

Hi There Supabeast,

I had a similar problem a few weeks ago.

My understanding is that you want to enter the FIRST letter (or the FIRST COUPLE of letters) of a name and then search. 
Setting the filter on the combobox to %s% will retrieve rows where the particular letter (or couple of letters) appears ANYWHERE in the name and not just at the start.  Unfortunately, setting the filter to s% (rather than %s%) doesn't seem to be an option.

If this is, indeed, the case, the easiest way of achieving what you want is simply to enter the first letter (or first couple of letters) of the name and then manually add %.

If you don't want to have to manually add the %, then i believe you'll need to change the action of the button from 'Search' to 'SQL Query' and in your WHERE clause use    where fieldname like '{edit1}%';

You might also want to perform an 'incremental search' so that the names filter as soon as you start typing.  Some people like the effect, some don't.  If you do, add the button to the 'incremental search' in the properties of the search field.

Hope this helps a bit and good luck.

Derek.

Re: Search result with first letter in a name?

Good Evening Dmitry,
Currently, the filter type %s% finds a character string ANYWHERE within a field.  Would it be possible to add a new filter type of s% so that the first (leading) character(s) of a field can be retrieved?  I know this can be done by using the SQL Query option but Search with a filter type of s% would be much easier and quicker.
Derek.

Re: Search result with first letter in a name?

Thanks for all the answers! I'll go with the %s% option, as I don't know how to write a SQL Query.

Re: Search result with first letter in a name?

Hello SupaBeast

Perhaps something like

SELECT * FROM mytable WHERE myfield like A%


JB

Re: Search result with first letter in a name?

derek wrote:

Good Evening Dmitry,
Currently, the filter type %s% finds a character string ANYWHERE within a field.  Would it be possible to add a new filter type of s% so that the first (leading) character(s) of a field can be retrieved?  I know this can be done by using the SQL Query option but Search with a filter type of s% would be much easier and quicker.
Derek.

Added in the beta version 1.51
http://myvisualdatabase.com/forum/viewtopic.php?id=1297

Dmitry.

Re: Search result with first letter in a name?

Good Evening Dmitry,
Just downloaded 1.51 and tried the new s% filter and it works very well - much easier and quicker to set up "begins with" searches now.
Thanks as always.
Derek.