by Dan_Jazz_Man » Thu Dec 18, 2008 10:32 am
OK, let me try to explain it again:
I have an "Expected PP Hit Flop" statistic. Its main expression is defined like this:
format ('{1}, ({2}), {3}',
format_number (cnt_holecard * 0.1175 - 2 * cnt_holecard_sqrt * 0.322, 0, false, false),
format_number (cnt_holecard * 0.1175, 0, false, false),
format_number (cnt_holecard * 0.1175 + 2 * cnt_holecard_sqrt * 0.322, 0, false, false) )
cnt_holecard column is defined like this: count(holdem_hand_player_statistics.id_holecard)
and it counts the number of times we have a specific pocket pair, it has summary type "sum" to show the total number of pocket pairs in the summary line. Obviously, I can't change its summary type to anything else.
cnt_holecard_sqrt column is defined like this: sqrt( count(holdem_hand_player_statistics.id_holecard) ).
I can change its summary type between "sum" and "copy", but neither make sense as you will see below. (I don't know what "append" does but it also doesn't give the correct result, nor do the other summary types).
Now, the problem is that I can't feed the cnt_holecard total value (the one that shows in the summary line for this column) and the cnt_holecard_sqrt total value (which is derived from it) into the summary expression. If I define the summary expression exactly the same:
format ('{1}, ({2}), {3}',
format_number (cnt_holecard * 0.1175 - 2 * cnt_holecard_sqrt * 0.322, 0, false, false),
format_number (cnt_holecard * 0.1175, 0, false, false),
format_number (cnt_holecard * 0.1175 + 2 * cnt_holecard_sqrt * 0.322, 0, false, false) )
then the values of cnt_holecard and cnt_holecard_sqrt are defined by whatever type of summary we have for cnt_holecard and cnt_holecard_sqrt.
It's not a problem with cnt_holecard, since instead of "cnt_holecard (AA+KK+ ... +22) * 0.1175" that we'd get if the cnt_holecard total value were used, we get "cnt_holecard (AA) * 0.1175 + cnt_holecard(KK) * 0.1175 + ... + cnt_holecard(22) * 0.1175. (Note that the notation is just to make things clear, it's not valid SQL, of course). In other words, instead of "cnt_holecard (value from the summary line) * 0.1175" we get the sum of "cnt_holecard (single pocket pair) * 0.1175", since cnt_holecard column has the summary type of "sum". It's fine, because by the law of multiplying out brackets the result is going to be the same (ignoring rounding errors).
The problem is with cnt_holecard_sqrt. We want to calculate "2 * 0.322 * cnt_holecard_sqrt" for the summary, or "2 * 0.322 * sqrt (cnt_holecard (AA+KK+ ... + 22))", but depending on the type of summary cnt_holecard_sqrt has, we get:
"2 * 0.322 * sqrt (cnt_holecard(AA)) + 2 * 0.322 * sqrt (cnt_holecard(KK)) + ... + 2 * 0.322 * sqrt (cnt_holecard(22))" - if the summary type is "sum";
"2 * 0.322 * sqrt (cnt_holecard (some pair)" - if the summary type is "copy";
Both of these results are incorrect of course.
The only workaround I see now is to duplicate cnt_holecard and cnt_holecard_sqrt columns, name them cnt_holecard_total and cnt_holecard_sqrt_total and try using them in the summary expression. Not sure, if it's going to work though.
I hope, I've cleared the situation up a bit, but then again, maybe I could PM you with the report to make it even more clear?