FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour question about Scopes
Posts: 417
Joined: Tue Feb 23, 2010 03:09 PM
question about Scopes
Posted: Sun Jul 03, 2011 10:36 AM
Hello,

I have a database with tree indexes, code, name and state:

CUSTOMER.DBF

CODE
NAME
ADDRESS
PHONE
STATE

I would like to set an Scope as an alternative to SET FILTER to xbrowse customers in state = "NY", instead of using:
Code (fw): Select all Collapse
SET FILTER TO FIELD->STATE = "NY"


But I want to order the results by code, but this is index 1.

if I set the scope such as:

Code (fw): Select all Collapse
SET ORDER TO 3

      OrdScope( 0, "NY" )
      OrdScope( 1, "NY" )
      Dbgotop()

     XBROWSE()

      OrdScope( 0, Nil )
      OrdScope( 1, Nil )

     SET ORDER TO 1



But I want the results ordered by code or number, not state.

Is it possible?.

Thank you very much :-).
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
Posts: 368
Joined: Sun May 31, 2009 06:25 PM
Re: question about Scopes
Posted: Sun Jul 03, 2011 12:24 PM

You have to create an index state+code_number and use the scope the way you did. The result will be shown order by code_number for the scoped state.

Regards,



André Dutheil

FWH 13.04 + HB 3.2 + MSVS 10
Posts: 417
Joined: Tue Feb 23, 2010 03:09 PM
Re: question about Scopes
Posted: Sun Jul 03, 2011 01:30 PM

Thank you.

So I have to change SET ORDER TO 3.

That is what I wanted to avoid.

Thanks

FWH 11.11, Harbour 3.1 and Borland C++ 5.82
Posts: 368
Joined: Sun May 31, 2009 06:25 PM
Re: question about Scopes
Posted: Sun Jul 03, 2011 02:08 PM

If you dont wat to change your index you might reopen you dbf with another alias set its order to 3, scope it, browse what you need and close it when finished.

Regards,



André Dutheil

FWH 13.04 + HB 3.2 + MSVS 10
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: question about Scopes
Posted: Sun Jul 03, 2011 02:14 PM

Why do you want to avoid that?

If you not using the index on 'state' somewhere else in your program, you can change the index 3 to state+code_number,
otherwise you can add a 4th index and use tis one for your scope.

Marc

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 417
Joined: Tue Feb 23, 2010 03:09 PM
Re: question about Scopes
Posted: Sun Jul 03, 2011 03:25 PM

Marc,

As it is runned in a network eviroment.

Thanks for helping ;)

FWH 11.11, Harbour 3.1 and Borland C++ 5.82
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: question about Scopes
Posted: Sun Jul 03, 2011 05:23 PM

>As it is runned in a network environment.

Why does that matter? If you are concerned about speed, then I expect it is still going to be way faster than a filter.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion