Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Marco Plaza
  Where is Marco Plaza?
 Caracas
 Venezuela
 Marco Plaza
 To: Tahir Iqbal
  Where is Tahir Iqbal?
 Lahore
 Pakistan
 Tahir Iqbal
 Tags
Subject: RE: Index
Thread ID: 373720 Message ID: 373732 # Views: 50 # Ratings: 1
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Tuesday, March 26, 2013 4:29:09 AM         
   


> I have following data
>
>
> Create Cursor CITY (places c(20))
> 
> Insert Into city Values("1 DB")
> Insert Into city Values("95 DB")
> Insert Into city Values("25 DNB")
> Insert Into city Values("78 BC")
> Insert Into city Values("9 DRB")
> Insert Into city Values("67 DB")
> Insert Into city Values("LAHORE")
> Insert Into city Values("33 BC")
> Insert Into city Values("47 DNB")
> Insert Into city Values("59 DRB")
> Insert Into city Values("KARACHI")
> 

>
> I want to display abvoe data in following index order
>
> KARACHI
> LAHORE
> 33 BC
> 78 BC
> 1 DB
> 67 DB
> 95 DB
> 25 DNB
> 47 DNB
> 9 DRB
> 59 DRB
>
> or as
>
> 33 BC
> 78 BC
> 1 DB
> 67 DB
> 95 DB
> 25 DNB
> 47 DNB
> 9 DRB
> 59 DRB
> KARACHI
> LAHORE
>
> what will be the index command?

Try:

Create Cursor CITY (places c(20))

Insert Into city Values("1 DB")
Insert Into city Values("95 DB")
Insert Into city Values("25 DNB")
Insert Into city Values("78 BC")
Insert Into city Values("9 DRB")
Insert Into city Values("67 DB")
Insert Into city Values("LAHORE")
Insert Into city Values("33 BC")
Insert Into city Values("47 DNB")
Insert Into city Values("59 DRB")
Insert Into city Values("KARACHI")

index on getwordnum(places,getwordcount(places))+transform(val(getwordnum(places,1)),'@L 999') tag temp
browse fields places,indexp=evaluate(key())

index on transform(getwordcount(places))+getwordnum(places,getwordcount(places))+transform(val(getwordnum(places,1)),'@L 999') tag temp
browse fields places,indexp=evaluate(key())




Marco

ENTIRE THREAD

Index Posted by Tahir Iqbal @ 3/26/2013 2:50:58 AM
RE: Index Posted by Jun Tangunan @ 3/26/2013 2:55:24 AM
RE: Index Posted by Tahir Iqbal @ 3/26/2013 2:58:32 AM
RE: Index Posted by Arslan Noman @ 3/26/2013 3:31:00 AM
RE: Index Posted by Tahir Iqbal @ 3/26/2013 3:46:07 AM
RE: Index Posted by Marco Plaza @ 3/26/2013 4:29:09 AM