FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour bugs xBrowse and Seek
Posts: 1303
Joined: Tue Jul 21, 2009 08:12 AM
bugs xBrowse and Seek
Posted: Sat May 25, 2013 07:18 PM
Hello,

With this sample, if I type GU for example, the Seek is not performed. I have to click on a column an type again to work.

Also, the button Clear does not work.

Thank you very much.


Code (fw): Select all Collapse
#include "fivewin.ch"
#include "xbrowse.ch"


function main()

   local cStr, oCn, oRs


   cStr  := "Driver={MySQL ODBC 3.51 Driver};Server=dolphintest.sitasoft.net;" + ;
            "Database=dolphin_man;User=test_dolphin;Password=123456;Option=3;"

   oCn   := FW_OpenAdoConnection( cStr )




   if oCn != nil

      oRs   := FW_OpenRecordSet( oCn, "select * from biblio order by titulo" )


      if oRs = nil
         msgstop("error opening")

         oCn:Close()
         RETURN NIL
      endif


      testLucas( oRs )

      oRs:Close()
      oRs := Nil

      oCn:Close()

   else

      msgstop( "Failed to Connect the Server")

   endif



QUIT

return nil
//----------------------------------------------------------------------------//



//-----------------------------------------------------------------------------
function testLucas( oRs )

   local oDlg, oBrw, oCbx, oFont, nWild := 2
   local nOpt        := 1




   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14

   DEFINE DIALOG oDlg SIZE 900,400 PIXEL ;
      TITLE FWVERSION ;
      FONT oFont

   @ 30,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
      DATASOURCE oRs AUTOCOLS AUTOSORT ;
      CELL LINES NOBORDER



   WITH OBJECT oBrw

      :nMarqueeStyle := 4
      :lIncrFilter   := .t.
      :lSeekWild     := .t. //( nWild == 2 )
      :cFilterFld    := "titulo"
      :nStretchCol   := STRETCHCOL_WIDEST

      :CreateFromCode()
   END




   @ 10, 80 SAY oBrw:oSeek PROMPT oBrw:cSeek SIZE 120,10 PIXEL OF oDlg ;
      COLOR CLR_RED,CLR_YELLOW

   @ 10, 300 BUTTON  "Clean" ACTION (MSGALERT(oBrw:cSeek), oBrw:cSeek:= ( "" ) , oBrw:Refresh(), oBrw:SetFocus(), MSGALERT(oBrw:cSeek) )  PIXEL


   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT ( oBrw:SetFocus(), .f. )

   RELEASE FONT oFont


Return nil

//----------------------------------------------------------------------------//
Muchas gracias. Many thanks.



Un saludo, Best regards,



Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]



Implementando MSVC 2010, FWH64 y ADO.



Abandonando uso xHarbour y SQLRDD.
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: bugs xBrowse and Seek
Posted: Sat May 25, 2013 07:34 PM

Lucas

Have a look at the sample AdoRick.prg .. good example of an incremental seek with xBrowse and Ado.

Rick Lipkin

Posts: 1303
Joined: Tue Jul 21, 2009 08:12 AM
Re: bugs xBrowse and Seek
Posted: Sat May 25, 2013 07:50 PM

Rick,

Your example is not working also.

I delete the string in the get and I don´t see results in xBrowse. In the past it worked.

Have you tested muy sample?. It is very simple.

Thank you.

Muchas gracias. Many thanks.



Un saludo, Best regards,



Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]



Implementando MSVC 2010, FWH64 y ADO.



Abandonando uso xHarbour y SQLRDD.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: bugs xBrowse and Seek
Posted: Sat May 25, 2013 11:23 PM
Mr Lucas

For clearing the seek, please use oBrw:Seek( '"" )
@ r,c, BUTTON ........... ACTION oBrw:Seek( "" )

About the incremental Seek ( not incremental filter ):
---------------------------------------
XBrowse decides if the oRs is sorted or not and if sorted the sort column name on the basis of Rs:Sort.
It does not read the source sql statement of the oRs to know the sorted column(s).

So for incremental seek to work initially we need to set oRs:Sort := <columnName>, just like we need to set OrdSetFocus() in RDD.

We may improve XBrowse to extract the sorted column name from the record set's source SQL, but at present it does not.

About the incremental Filter:
---------------------------------
Thanks for bringing this case to our notice.

You might have tested and seen working in many other cases. Even here, it works on "signatura" and other fields, but fails only on "titulo".

It is failing when the value of the field in the current row is NULL. If you move to a row, where the value of "titulo" is NOT NULL, then again the incremental filter works.

The filter expression differs for character, numeric and date fields. So xbrowse first ascertains the datatype by calling ValType( ::oRs:Fields( <colname> ):Value ) and then proceed to build a filter expression suitable to the datatype. Obviously this approach is failing when the value is NULL in the current row.

We shall improve by changing the logic to ascertain the datatype from the Field(...):Type. I can not post the modification here because it will be too lengthy.
Meanwhile you can do this:
Please go to METHOD AdoIncrSeek and locate the following line:
Code (fw): Select all Collapse
      do case
      case cType == 'C'

Change it as
Code (fw): Select all Collapse
      do case
      case cType == 'C' .or. uVal == nil

Well with this modification incremental filters on numeric and date columns may fail.
For complete implementation, please wait for the next release.

Interestingly, SQLite allows storage of any datatype of any length in a field of any datatype. I understand it is not even necessary to specify field type while creating a table.
We can only fine tune xbrowse to SQLite after really working with it, because right now xbrowse expects data of the same type in all rows of a column, except for Arrays May be xbrowse needs to handle SqLite like it handles arrays.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: bugs xBrowse and Seek
Posted: Sat May 25, 2013 11:36 PM
Rick Lipkin wrote:Lucas

Have a look at the sample AdoRick.prg .. good example of an incremental seek with xBrowse and Ado.

Rick Lipkin

XBrowse natively implemented for long for RDD, ADO, Array.
1. Incremental Seek
2. Incremental wild seek'
3. Incremental filter
4. Incremental wild filter ( anywhere )

Recently implemented for TDolphin also.(partly).

It all requires setting some vars of xbrowse on/off and does not require any coding and the same settings work the same way whatever the datasource we are browsing : dbf/ado/etc
You may save time using built-in features.
Regards



G. N. Rao.

Hyderabad, India
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: bugs xBrowse and Seek
Posted: Wed May 29, 2013 12:00 PM

Mr Nages
Can you make a small test sample with Incremental Filter but with some fields
sample for customer.dbf Last+First+State

because I Know How make it for only one field. Thanks!!

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: bugs xBrowse and Seek
Posted: Wed May 29, 2013 03:30 PM
Silvio.Falconi wrote:Mr Nages
Can you make a small test sample with Incremental Filter but with some fields
sample for customer.dbf Last+First+State

because I Know How make it for only one field. Thanks!!

Simple
Code (fw): Select all Collapse
oBrw:cFilterFld := "LAST + FIRST + STATE"
Regards



G. N. Rao.

Hyderabad, India
Posts: 518
Joined: Fri Jun 29, 2012 12:49 PM
Re: bugs xBrowse and Seek
Posted: Thu May 30, 2013 09:11 AM
Mr. Nages,

I am bit lost with those features, and also there is no info at wiki or Fivewin´s manuals:

XBrowse natively implemented for long for RDD, ADO, Array.
1. Incremental Seek
2. Incremental wild seek'
3. Incremental filter
4. Incremental wild filter ( anywhere )


Please, could you explain the differences and pros and cons?.

Thank you so much.

Continue the discussion