Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
killjack
Beginner


Joined: 21 Oct 2007
Posts: 11

PostPosted: Wed Oct 24, 2007 12:56 am   

how to get the record number sorted in view of database?
 
for example. build a database named quests.db and insert some records as following:
recordnumber type name cost
0 weapon a 10
1 armor b 50
2 drug c 30

then sorted these records by cost in a view named order and get the following order.

recordnumber type name cost
0 weapon a 10
2 drug c 30
1 armor b 50

my problem is how to get the recordnumber sorted and set them to other variables, such as.
first= the no. 1 record number sorted
second=the no. 2 record number sorted
third = the no. 3 record number sorted

any suggestion is appreciated!
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Oct 24, 2007 1:31 am   
 
If I am following what you want correctly then this can be done with a %query, don't quote me on the field of Num though that is from memory, and the last time I really played with the DB was 2 years ago.
Code:
#DBRESET
variable=%query(&Num!="",order)
Should put a list of records into 'variable' where the order of entries in the list matches the sort order for the view 'order'.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
killjack
Beginner


Joined: 21 Oct 2007
Posts: 11

PostPosted: Wed Oct 24, 2007 1:54 am   
 
yeah,that solves my problem!
Thank you very much, Vijilante!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net