question about Scopes

question about Scopes

Postby ukservice » 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: Select all  Expand view
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: Select all  Expand view
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
User avatar
ukservice
 
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: question about Scopes

Postby ADutheil » 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
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: question about Scopes

Postby ukservice » Sun Jul 03, 2011 1: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
User avatar
ukservice
 
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: question about Scopes

Postby ADutheil » Sun Jul 03, 2011 2: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
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: question about Scopes

Postby Marc Vanzegbroeck » Sun Jul 03, 2011 2: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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: question about Scopes

Postby ukservice » Sun Jul 03, 2011 3: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
User avatar
ukservice
 
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: question about Scopes

Postby James Bott » Sun Jul 03, 2011 5: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

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