Need help with custom stat

Forum for users that want to write their own custom queries against the PT database either via the Structured Query Language (SQL) or using the PT3 custom stats/reports interface.

Moderator: Moderators

Need help with custom stat

Postby Christian H » Fri Feb 27, 2009 1:59 pm

HI,

I would like to build a stat that tells me how many times a player raised with a certain subset of hands, say AA-KK. I tried different variations of the following but couldn't make it work.

(1) Create a colum called holecard_big_pairs in 'Holdem Cash Player Statistics' with the subset of hands.
if[holdem_hand_player_statistics.id_holecard = 1 OR holdem_hand_player_statistics.id_holecard = 26, 1, 0].

(2) Create the sum.
sum(if[holdem_hand_player_statistics_cnt_p_raise > 0 AND holecard_big_pairs = 1, 1, 0])

Apparently (2) is not a valid SQL statement.

Thanks,
Christian H
Christian H
 
Posts: 6
Joined: Tue May 20, 2008 4:16 pm

Re: Need help with custom stat

Postby kraada » Fri Feb 27, 2009 3:01 pm

The way the HCPS section works is that for each column it has a value after evaluating for all hands. So what you're trying to do won't work.

What will work though is:

sum(if[holdem_hand_player_statistics_cnt_p_raise > 0 AND (holdem_hand_player_statistics.id_holecard = 1 OR holdem_hand_player_statistics.id_holecard = 26), 1, 0])

Now it's all evaluated at once and you'll get a count of how many times they raised preflop when their holecards are AA or KK.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Need help with custom stat

Postby Christian H » Fri Feb 27, 2009 6:07 pm

Thanks for your quick reply, it worked beatifully. But it leaves me confused for two reasons.

Firstly, if I make a statistic equal to the colum I created (holecard_big_pairs) and then a report with only this statistics it returns a 0/1-value for each hand, which to my untrained eye, seems to contradict what you wrote.

Secondly, there are premade colums in the HCPS section like id_holecard that only make sense if they have a value for each hand.

I know you guys have received a lot of critisisme in the development phase but I for one really like what you have done, in particular the custom statistics and report section. Without any previous experience with databases I have been able to do a lot without too much hassle. So far there is only one thing I really miss and that is a rename option for colums, statistics and reports. Hopefully, that is something you will consider once the more urgent stuff is done.

Christian H
Christian H
 
Posts: 6
Joined: Tue May 20, 2008 4:16 pm

Re: Need help with custom stat

Postby WhiteRider » Sat Feb 28, 2009 6:15 am

Christian H wrote:Firstly, if I make a statistic equal to the colum I created (holecard_big_pairs) and then a report with only this statistics it returns a 0/1-value for each hand, which to my untrained eye, seems to contradict what you wrote.

Holdem Cash Player Statistics gives totals for all hands on a player, so sum(if[...]) is effectively iterating through all your hands and seeing if the condition is true and adding either 1 or 0 to give a total count of how many times you raised with a big pair.
If you create a statistic to display just this column you should get a count, e.g. 12 if you raised 12 times with a big pair.

Have a look at this post which explains this process in more detail.

Just in case this makes a difference, there is a typo in Kraada's column:
sum(if[holdem_hand_player_statistics_cnt_p_raise > 0 AND (holdem_hand_player_statistics.id_holecard = 1 OR holdem_hand_player_statistics.id_holecard = 26), 1, 0])
"holdem_hand_player_statistics_cnt_p_raise" should be "holdem_hand_player_statistics.cnt_p_raise", but I guess you have this correct or it wouldn't validate.

Secondly, there are premade colums in the HCPS section like id_holecard that only make sense if they have a value for each hand.

These columns are used for the Statistics like 'HoleCards' which are used to break up the Starting Hands report into a row for each starting hand (i.e. hand type, not each actual hand).
If you include this stat in your report you will get a row for each starting hand, if you don't include it then stats for all your hands will be on one row. Similarly for Site, Position, Limit, etc.

So far there is only one thing I really miss and that is a rename option for colums, statistics and reports. Hopefully, that is something you will consider once the more urgent stuff is done.

For Statistics and Columns you can use the Duplicate button to make a copy which you can rename, then you can delete the old version.
WhiteRider
Moderator
 
Posts: 54025
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK


Return to Custom Stats, Reports, and SQL [Read Only]

Who is online

Users browsing this forum: No registered users and 0 guests