Is it possible seek Numeric field with xBrowse ?
Regards MAurizio
Autoincremental search of Numeric field in xBrowse
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Hello
I change the Method Seek() and now works
* if !Eval( ::bSeek, cSeek )
* Eval( ::bBookMark, uBook )
* MsgBeep()
* return nil
* endif
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
I change the Method Seek() and now works
* if !Eval( ::bSeek, cSeek )
* Eval( ::bBookMark, uBook )
* MsgBeep()
* return nil
* endif
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
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
It can be done without changing xbrowse library code. And I personally prefer writing the code without touching library code generally.
This is all what is needed ( I am using softseek )
This is all what is needed ( I am using softseek )
Code: Select all | Expand
oBrw:bSeek := { |cSeek| CUST->( DbSeek( Val( cSeek ), .t. ), !eof() ) }
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
This is a sample code. This sample also shows the value being sought
We can seek any data type, without modifying the xbrowse source code.
Code: Select all | Expand
#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 nil
We can seek any data type, without modifying the xbrowse source code.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
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
True
I gave the sample to demonstrate that XBrowse lets us do the real code to Seek. We need to code how do we seek the value entered by suitably coding the bSeek codeblock and not by changing the XBrowse source code.
Sure we can write more generic code.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India