|
Haldrik Wanderer
Joined: 03 Sep 2007 Posts: 88
|
Posted: 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 :) |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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.
|
|
|
|
Haldrik Wanderer
Joined: 03 Sep 2007 Posts: 88
|
Posted: 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... |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon May 18, 2009 3:15 pm |
Your variables are strings, not numbers. Try using %int on them first.
|
|
|
|
Haldrik Wanderer
Joined: 03 Sep 2007 Posts: 88
|
Posted: Tue May 19, 2009 1:22 am |
Much love fang :)
Thanks. |
|
|
|
|
|