Is it possible seek Numeric field with xBrowse ?
Regards MAurizio
www.nipeservice.com
Is it possible seek Numeric field with xBrowse ?
Regards MAurizio
Yes.
We need to write the appropriate seek function and assign it as codeblock to oBrw:bSeek. We can do anything we want with this codeblock.
Hello
I change the Method Seek() and now works
Select (::cAlias)
cOrderType := Valtype(& ("field->" + ( ::cAlias )->( OrdKey() ) ))
if !Eval( ::bSeek, iif(cOrderType == "N", val(cSeek) , cSeek ))
IF cOrderType == "N"
::cSeek := cSeek
ELSE
MsgBeep()
ENDIF
Eval( ::bBookMark, uBook )
return nil
endif
Regards MAurizio
oBrw:bSeek := { |cSeek| CUST->( DbSeek( Val( cSeek ), .t. ), !eof() ) }#include 'fivewin.ch'
#include 'xbrowse.ch'
REQUEST DBFCDX
function Main()
local oDlg, oBrw
local oSeek, cSeek := Space(25)
USE CUSTOMER NEW ALIAS CUST SHARED VIA 'DBFCDX'
SET ORDER TO TAG SALARY
GO TOP
DEFINE DIALOG oDlg SIZE 540,480 PIXEL
@ 10, 10 XBROWSE oBrw ;
COLUMNS 'First','Last','Salary' ;
SIZE 250,200 PIXEL ;
OF oDlg ;
ALIAS 'CUST' ;
AUTOSORT
@ 220, 10 SAY oSeek VAR cSeek SIZE 100,10 PIXEL OF oDlg ;
COLOR CLR_BLACK, CLR_YELLOW
oBrw:bSeek := { |cSeek| CUST->( DbSeek( Val( cSeek ), .t. ), !eof() ) }
oBrw:oSeek := oSeek
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg CENTERED
return nilThank NageswaraRao
I try your sample , it works but only on the numeric Col. If you have two Col ( one numeric and one character ) and you need both seek
doesn't works .
Maurizio
Maurizio wrote:Thank NageswaraRao
I try your sample , it works but only on the numeric Col. If you have two Col ( one numeric and one character ) and you need both seek
doesn't works .
Maurizio