FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse - dbSeek
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
xBrowse - dbSeek
Posted: Fri Sep 18, 2009 01:08 PM

If there is no index order selected and you use
oxBrw:bSeek := {|c| DbSeek( Upper( c ) ) }
xBrowse crashes.

Perhaps xBrowse could handle this.

I use
oxBrw:bSeek := {|c| iif( indexord() > 0,;
DbSeek( Upper( c ) ) ,( msginfo("keine Sortierung ausgewählt"), .f.) ) }

Best regards,
Otto

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: xBrowse - dbSeek
Posted: Fri Sep 18, 2009 03:30 PM

Otto,

With what error?

You should either be using alias referencing or better, a database object.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: xBrowse - dbSeek
Posted: Fri Sep 18, 2009 04:59 PM

Hello James,
thank you for your answer.
Workarea not in use.
I only think that xBrowse should handle such input errors and act like a blackbox.

You can reproduce what I mean if you insert a
set order to

before:
oxBrw:bSeek := {|c| DbSeek( Upper( c ) ) }

Best regards,
Otto

Best regards,
Otto

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: xBrowse - dbSeek
Posted: Fri Sep 18, 2009 08:59 PM

Otto,

Try this:

oxBrw:bSeek := {|c| (::cAlias)->(DbSeek( Upper( c ) )) }

Take a look at TXBrowse:setRDD(). If you use that and set lAutoOrder =.t. then you bSeek will be set automatically by xbrowse.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse - dbSeek
Posted: Sat Sep 19, 2009 04:36 AM
oxBrw:bSeek := {|c| (::cAlias)->(DbSeek( Upper( c ) )) }

Even this fails if no order is set.

XBrowse assigns a default bSeek only when lAutoOrder is specified. When we specify lAutoOrder, it is better to leave the responsibility of defining bSeek to XBrowse.

If lAutoOrder is not specified and incremental search is desired, it is the responsibility of the programmer to specify a safe and appropriate codeblock for bSeek, taking care of the appropriate alias, checking indexorder, etc.

XBrowse supports any kind of data collection, not necessarily the well known dbf, array, recset, etc.
So when the codeblocks are directly defined by the programmer, he is expected to take full responsibility of the necessary checks.
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion