XBrowse with SQLRDD

XBrowse with SQLRDD

Postby PeterHarmes » Wed Feb 10, 2010 12:43 pm

Hi,

I'm using a sequential search on a table opened with SQLRDD and when i search for a record in xbrowse it works for the first key i press, but the second key that i press, the xbrowse successfully finds the record, but the display is corrupted. I've had a look at the source code for xBrowse and could see that it is referencing ::Keyno() to reposition the vertical scrollbar, could this be the cause?

Is anyone else using xBrowse with SQLRDD and getting the same problem? I never had this problem with a LISTBOX. The same code is working correctly under DBFCDX.

Any advise would be appreciated

Regards,

Pete
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: XBrowse with SQLRDD

Postby PeterHarmes » Wed Feb 10, 2010 2:27 pm

Just a quick update...

I've managed to "fix" it by doing this:

Code: Select all  Expand view


oBrw:bSeek := {|c| IF( &cDbf.->(DbSeek( cPreSeek + Upper( c ) )), IF(mSql,(oBrw:Refresh(), .T.), .T.), .F.) }   //Set Incremental Search Rules

before it was:

oBrw:bSeek := {|c| &cDbf.->(DbSeek( cPreSeek + Upper( c ) )) }   //Set Incremental Search Rules

 


This fixes the corruption under SQLRDD, however when the 2nd key is pressed, the record that is found always jumps to the 2nd position in the browse?!?! the rest of the browse is now fine though - it just looks a bit weird!!
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: XBrowse with SQLRDD

Postby nageswaragunupudi » Wed Feb 10, 2010 4:40 pm

t is referencing ::Keyno() to reposition the vertical scrollbar, could this be the cause?

Incremental seek and method KeyNo() are in no way related.

Code: Select all  Expand view
DbSeek( cPreSeek + Upper( c )

The parameter provided by XBrowse while evaluating the bSeek codeblock, is the buffer including the present key stroke. Adding this buffer to the previous buffer gives erroneous results. Instead just the DbSeek( c ) should be used.

While using special RDDs like SQLRDD, the following points need to be kept in mind:
XBrowse assumes that the RDD supports all the ord* functions and these functions provide reliable results. If for any reason, we suspect some functions may not work correctly, then only we need to build our own codeblocks or otherwise, we better leave the building of codeblocks to XBrowse.

1. oBrw:bKeyNo: The bKeyNo codeblock automatically generated by XBrowse depends on OrdKeyNo() and OrdKeyGoTo( n ) functions. If we feel that these functions are not properly supported by the RDD or if these functions provide the same results as RecNo() and DbGoTo() functions, we may set oBrw:bkeyNo := oBrw:bBookMark

2. oBrw:bSeek: If we specify AUTOSORT clause in command syntax or lAutoOrder ( 2nd parameter ) as .t. in SetRDD( cAlias, .t. ) method, XBrowse automatically creates the bSeek codeblock. This codeblock is quite advanced and works perfectly. But this codeblock depends on OrdKey(), OrdSetFocus() and DbSeek() functions. In case oBrw:lWildSeek is set to .t., this also uses OrdWildSeek() function.
If we suspect this codeblock may not be working properly with any particular RDD, we may try the following two simple variations:

oBrw:bSeek := { |c| ( oBrw:cAlias )->( DbSeek( c ) ) }
or
oBrw:bSeek := { |c| ( oBrw:cAlias )->( DbSeek( Upper( c ) ) ) }
as may be required.
Regards

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

Re: XBrowse with SQLRDD

Postby PeterHarmes » Wed Feb 10, 2010 4:58 pm

Thanks for your reply,

I believe SQLRDD does not support OrdKeyNo() as i used to use this for selecting multiple records in browses and I couldnt get it to work under SQL. The change i have done, while isnt pretty, fixes the main problem.

btw, the DbSeek( cPreSeek + Upper( c ) ) is not seeking the previous buffer - the example i gave was in a function where i use a scope and cPreseek is the scoped element of the index.

Regards,

Pete
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 87 guests