bugs xBrowse and Seek

bugs xBrowse and Seek

Postby lucasdebeltran » Sat May 25, 2013 7: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: Select all  Expand view
#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.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: bugs xBrowse and Seek

Postby Rick Lipkin » Sat May 25, 2013 7:34 pm

Lucas

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

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2628
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: bugs xBrowse and Seek

Postby lucasdebeltran » Sat May 25, 2013 7: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.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: bugs xBrowse and Seek

Postby nageswaragunupudi » 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: Select all  Expand view
     do case
      case cType == 'C'
 

Change it as
Code: Select all  Expand view
     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
User avatar
nageswaragunupudi
 
Posts: 10254
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: bugs xBrowse and Seek

Postby nageswaragunupudi » 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
User avatar
nageswaragunupudi
 
Posts: 10254
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: bugs xBrowse and Seek

Postby Silvio.Falconi » 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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6796
Joined: Thu Oct 18, 2012 7:17 pm

Re: bugs xBrowse and Seek

Postby nageswaragunupudi » Wed May 29, 2013 3: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: Select all  Expand view

oBrw:cFilterFld := "LAST + FIRST + STATE"
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10254
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: bugs xBrowse and Seek

Postby elvira » Thu May 30, 2013 9: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.
elvira
 
Posts: 515
Joined: Fri Jun 29, 2012 12:49 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 19 guests