FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Incremental Search
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Incremental Search
Posted: Thu May 08, 2014 08:56 PM
Marcelo,

it is easy for the user we can define how we can search the data and we don't need to use mouse,


Please be more specific about how you want to search. The combobox can do incremental searching.

And if you automatically drop down the list the user doesn't have to use the mouse.

So I am wondering what you wish to do that can't already be done with either the combobox or dbcombo?

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: Incremental Search
Posted: Thu May 08, 2014 09:12 PM

James,

can you post a simple sample?, to see the best approach.

regards

Marcelo

Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: Incremental Search
Posted: Fri May 09, 2014 01:32 PM
Hello,

here you can download other sample

https://app.box.com/s/48nd61t4sxe5d319c5bm

criteria for search can be defined for the user, the view list size too.

regards

Marcelo
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: Incremental Search
Posted: Fri May 09, 2014 03:48 PM
Holas,

this is the code to define the control

Code (fw): Select all Collapse
Function Main()
   Local oDlg
   Local oGet, oGet1
   local cVar := space( 20 )
   local a := {}

   USE customer NEW 
   customer -> ( DBEVAL( {|| AADD( a, field -> street ) } ) )

   DEFINE DIALOG oDlg from 0,0 to 400,400 pixel

   @ 15,15 get oGet  var cVar picture "@!" size 120,12 of oDlg pixel
      
   @ 29,15 get oGet1 var cVar picture "@!" size 120,12 of oDlg pixel

   oGet:aSource  := a
   oGet:bSearch  := {|i,e| AT( i, UPPER(e) ) > 0 }
   oGet:cSource  := 'ARRAY'
   oGet:lenDisplay := 15
   
   ACTIVATE DIALOG oDlg 
 
   USE

 return nil
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Incremental Search
Posted: Fri May 09, 2014 04:02 PM
Marcelo,

can you post a simple sample?, to see the best approach.


See the info in one of my previous posts in this thread.

here you can download other sample


I don't see that it provides anything that a combobox or dbcombo doesn't do. Also, your example lets the user type in characters that don't match anything in the list which may be confusing to the user.

I do see one problem. I have not been able to find a way to automatically force the list open on the first keystroke with a combobox or dbcombo. I think this will require some changes to the combobox class source code, but this can be easily done.

I have also found that the sound doesn't work since it calls the old Clipper tone() function which doesn't work under windows. The sound was used to provide audible feedback to the user when a keystroke matches data--there was no sound when it doesn't match. This can also be easily fixed.

criteria for search can be defined for the user


With a combobox the search can be defined as either incremental or not (each keystroke finds the first match only). What other criteria do you need to define?

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: Incremental Search
Posted: Fri May 09, 2014 06:06 PM
James,

please donwload again

https://app.box.com/s/a7lamqj1z427k4a8n34j

I added a combox in the same sample with the same data, please try to find "pico" in GETLIST and in ComboBox

regards

Marcelo
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Incremental Search
Posted: Sat May 10, 2014 04:55 PM
Marcelo,

OK, I see you are doing an incremental CONTAINS search. The combobox control only does searches on the left-most characters and is useful for such seaches as city, item, description, etc. And the database must be indexed.

The combobox control might be able to handle a CONTAINS search using the bChange codeblock.

Your control doesn't seem all that useful searching for Pico, since there are a number of Pico's but they are not sequential so the user only gets the first occurrence and then would have to scroll through the rest of the database looking for other Picos. [I note that it doesn't allow scrolling currently.] I think to be useful you would have to delete all items in the array that don't contain the search characters and this would have to be done after each keystroke. Another complication would be if the user backspaced, then the array would have to be reloaded and then items NOT matching the search characters left after the backspace would have to be deleted. CONTAINS type searches are better done having the user type in the complete search, then pressing a Search button--it is much less complicated and much faster than incremental searching. Still it could be slow since every record in the database has to be processed.

Your incremental CONTAINS search might work on very small lists, but certainly street databases could be tens of thousands or even millions of records long.

I also wonder how you then get the record ID when the user chooses an address. With dbcombo you can display the street and return the record ID.

Searches can be complicated.

Regards,
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: Incremental Search
Posted: Sun May 11, 2014 02:06 PM

James,

The search is done over all the table until get the number of records you want to display (in the sample 15, oGet:lenDisplay := 15, the common is 5), for that reason there is no scroll

It's an early test, the idea is to work like DBCombo displaying some column reated with another column of the table for result.

I can see there are not interest in this control, if I have some time I will try to finish it, James, sorry for lost your time

regards

Marcelo

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Incremental Search
Posted: Mon May 12, 2014 02:36 PM
Marcelo,

The search is done over all the table until get the number of records you want to display (in the sample 15, oGet:lenDisplay := 15, the common is 5), for that reason there is no scroll


But I wonder, did you intend to only show records containing the search term. For instance, now there are only 4 of the 15 records containing the search term (pico). Also, it seems for large databases this is going to be very slow since every record in the database is going to have to be read and searched for each keystroke. It might be possible to create an index that doesn't contain the first item (address number in this case) which would be much faster. However, users would only be able to search on the second item (street name in this case).

I can see there are not interest in this control, if I have some time I will try to finish it, James, sorry for lost your time


I did not mean to imply that I was not interested. I am just trying to find out what you are hoping to accomplish and pointing out some of the issues with the current design. Users are only interested in getting the result they need as fast as possible.

I don't think time is lost pursuing any of these ideas. Without trying new things we don't learn anything new or develop anything new.

Please let is know of your progress.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 33
Joined: Thu Jul 04, 2013 09:28 PM
Re: Incremental Search
Posted: Fri May 16, 2014 06:07 PM

Marcelo, could you post source code this class (TGET / incremental search) ?

Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: Incremental Search
Posted: Fri May 16, 2014 06:24 PM

Eduardo,

I will try to become independent the source code, creating a new class inheritance from TGet class. When I will have some new, I will publish it in the forum

regards

Marcelo

Posts: 33
Joined: Thu Jul 04, 2013 09:28 PM
Re: Incremental Search
Posted: Fri May 16, 2014 06:40 PM

The class the way it is already will help me a lot. Even without finishing you can post or send on my email?

Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: Incremental Search
Posted: Sat May 17, 2014 08:30 PM

Continue the discussion