Author Topic: Formula error  (Read 2312 times)

brunobus

  • Newbie
  • *
  • Posts: 47
    • View Profile
Formula error
« on: December 04, 2007, 09:20:26 PM »
I'm not sure what is happening, but I tested this previously, and it seemed to work perfectly, but now I'm getting a Formula Error.  Corey, I think you were to one who suggested these formulas.

I need one that will give me the total of the top 7 of 8 scores, but only if you play 3 or more tournaments.
I need a second one that will give me the total of the 6 lowest scores, but only if you play 7 or more tournaments.

Here's what I have.

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 6216
    • View Profile
Re: Formula error
« Reply #1 on: December 05, 2007, 10:28:59 AM »
It works just like it is.  This is the glitch where I enabled an internal setting that gives an error if you include a variable that isn't considered "valid".  This is supposed to help you if you typo a variable name, but unfortunately that list of valid variables omitted "numberOfScores" and "s" (both are the same).  So the formula's fine, but the test dialog just tells you it is not.  I've fixed this for the next version.

brunobus

  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: Formula error
« Reply #2 on: December 07, 2007, 07:43:22 PM »
That's good that it will be fixed, but with 3 tournaments played so far, I didn't get any results from the filter.  I changed the variable to n for number of games and that seems to work.

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 6216
    • View Profile
Re: Formula error
« Reply #3 on: December 09, 2007, 02:23:51 PM »
numberofscores and s are both valid variables, meaning if you place them in your formula they will be set to the proper values.  However, they are not listed in the set of variables that the dialog knows to be valid, and therefore when you, in the dialog, test a formula containing either of these variables, the dialog will report a formula error because it thinks the variable(s) to be invalid.  It's just a test error - they will work when computing stats.

n, or numberoftournaments, is not necessarily the same.  It holds the number of tournaments that pass your filter, not necessarily the number of tournaments that player has played.  If all of your players play in all of your tournaments, then that's fine (numberoftournaments will be the same as numberofscores for every player).  Otherwise, it could skew the results.

brunobus

  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: Formula error
« Reply #4 on: December 13, 2007, 08:39:35 PM »
I am trying with s, but my total score comes out as 0 for all players.  The formula is if(s<=2,0,sum(top(7,scores))).  You are right about the n, it posted a score for every player, whether they played in 1 tournament or 3.  But it it filtering a total of 3 tournaments and many players have 3 scores, but it's showing up as 0. 

if(numberofscores<=2,0,sum(top(7,scores))) doesn't work either.

I also tried if(numberofscores>2,0,sum(top(7,scores))) and if(s>2,0,sum(top(7,scores))) and I get the same result, a 0.

I know that the "top" and "bottom" functions are working properly since when I used n, it gave me a score.  I have another formula that drops the players lowest score, if(s<=2,0,sum(sum(top(7,scores))-sum(bottom(1,scores)))).  It also give a 0 with s but does the calcs ok (although incorrectly as you mentioned) with n.

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 6216
    • View Profile
Re: Formula error
« Reply #5 on: December 17, 2007, 11:34:57 AM »
Ugg, you're absolutely right.  This took some digging, but it appears I have been wrong.  This "glitch" causes the formula to fail to compile.  So when it comes time to computing the overall scores, essentially it doesn't even try, because it believes the formula is invalid.  Sorry about this.

Well, I've already fixed this for 2.5.  Hopefully, first beta of 2.5 will be out today, or at least this week.

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 6216
    • View Profile
Re: Formula error
« Reply #6 on: December 17, 2007, 11:39:02 AM »
Forgot the workaround:

replace "numberOfScores" (or s) with "count(scores)"


brunobus

  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: Formula error
« Reply #7 on: December 17, 2007, 09:18:21 PM »
 ;D Cool.  Thanks.