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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
tekky
Beginner


Joined: 08 Feb 2006
Posts: 25

PostPosted: Sat Jun 04, 2011 4:31 am   

View filter option?
 
Is the view filter option (not mentioned in the #view command documentation that I found) actually designed to filter data?

I have a DB that has the following columns

who
skill
count
last

and 2 entries
pet1|training|1|1
pet2|training|1|1

if I create 2 views set to Filter on who EQUALS "<petname"> both views show both pets data....

What is missing here?
_________________
-Karl
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon Jun 06, 2011 3:55 pm   
 
It filters the _columns_ that are viewed, but not which rows are viewed.
Reply with quote
tekky
Beginner


Joined: 08 Feb 2006
Posts: 25

PostPosted: Wed Jun 08, 2011 5:17 am   
 
Hmm guess my reply didnt get submitted....

Is there a way of filtering rows? Filtering columns seems a bit pointless :(
_________________
-Karl
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4715
Location: Pensacola, FL, USA

PostPosted: Wed Jun 08, 2011 5:43 am   
 
#FORALL @dbVar {#IF (%match(%i, "some pattern")) {#SAY {%i is @dbVar.%i}}}
_________________
Discord: Shalimarwildcat
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Jun 08, 2011 1:16 pm   
 
He's dealing with the internal database, not database variables. Tekky, you want the %query() function or #QUERY command. Note that both of these apply to a view; that's why defining views is useful. By combining queries with views, you can present any set of rows and columns you want.
Reply with quote
tekky
Beginner


Joined: 08 Feb 2006
Posts: 25

PostPosted: Wed Jun 08, 2011 3:43 pm   
 
Rahab,
I'll take a look at that, I think ultimately I'm going to investigate SQLite/Postgres support I saw last night, -- I believe I did play around with %query but could never get the results I expected from it.... Since none of my db's care about different columns, its always large subsets of data based on 1 particular row value in which case views apparently do not provide any added benefit there :(
_________________
-Karl
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Jun 08, 2011 5:29 pm   
 
Yeah, you'd be using the default view--all columns. But the old database system is definitely clunky, and you'll get a lot more flexibility with SQLite or even Cmud database variables, now that they use json.
Reply with quote
tekky
Beginner


Joined: 08 Feb 2006
Posts: 25

PostPosted: Wed Jun 08, 2011 8:30 pm   
 
Rahab wrote:
Yeah, you'd be using the default view--all columns. But the old database system is definitely clunky, and you'll get a lot more flexibility with SQLite or even Cmud database variables, now that they use json.


I thought about using DB Vars.... however what I am trying to track has lots of redundancy skills for example, your player learns skills (its useful track progress as you learn) -- you can purcahse pets and train them in some skills... (also useful to know for effective training) so.... my skills var would end up being smoething like

Code:

@skills
    player
          skill1
              count
              lasttime
          skill2
               count
               lastime
    pet1
          skill1
              count
              lasttime
          skill2
               count
               lastime
    pet2
          skill1
              count
              lasttime
          skill2
               count
               lastime

Obviously this is not how it would appear in the var but just a Tree representation of it (and the source of one of my previous questions you answered) -- Actually thinking about that... now that I have that working properly I *could* probably adapt it to this and it be pretty simple...

@skill([who], [skill], [prop]) and @skill([who], [skill], [prop], [value]) to set them...

But having a True database lets me play with the data outside of the Client as well (which I have an idea for aswell.... )
_________________
-Karl
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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