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
Haldrik
Wanderer


Joined: 03 Sep 2007
Posts: 88

PostPosted: Mon May 18, 2009 12:32 pm   

Database Calculations? How to? %average, etc?
 
Hey guys, recently started adding some data mining and having a hard time using %average/%sum etc.

What would be the best way to analyze this data? I couldn't figure out how to get %average to work.
I tried numerous #SHOW %average(2, stealdata) etc etc.

It's a pretty simple record. I could probably even use a stringelist..

#add stealrun 1
#addkey StealData @stealrun %1

So...
@Stealdata
Key Value
1 2342
2 2525
3 5677
4 4224


Thanks guys :)
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon May 18, 2009 1:28 pm   
 
%average and %sum are for the actual database module, not for data record variables. You'll want to write your own average and sum functions for variables using #loopdb, it shouldn't be terribly difficult.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Haldrik
Wanderer


Joined: 03 Sep 2007
Posts: 88

PostPosted: Mon May 18, 2009 2:40 pm   
 
Awesome. Workin good so far. 1 small / minor glitch. I'm trying to use #ADD and #MATH and instead of adding the %var together, its just ADDing it to the end of the list.

So 3406 + 4000 is turning into 34064000 instead of 7406.

Probably some silly mistake...
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon May 18, 2009 3:15 pm   
 
Your variables are strings, not numbers. Try using %int on them first.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Haldrik
Wanderer


Joined: 03 Sep 2007
Posts: 88

PostPosted: Tue May 19, 2009 1:22 am   
 
Much love fang :)


Thanks.
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