help writing tourn stat to group stacks into # of BB's

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

help writing tourn stat to group stacks into # of BB's

Postby denutza » Fri Aug 07, 2009 6:30 pm

Beginner advice needed.

I want to be able to write a custom stat showing when I have X # of BB's (tournament stat).

So if I have 1-5 bb's for example:

It appears the I need to use the following two columns:

"amt_blind": is the amount posted as a big blind sum(tourney_holdem_hand_player_detail.amt_blind)
"amt_before": is the starting stack size tourney_holdem_hand_player_detail.amt_before

Ive tried blending these two together, but all I get is division errors or "must be used in an aggregate function"
Ive tried making my own amt_before2 stat making it a sum.

I could possibly make my own flg when the conditionals for each BB zone...(If BB's >=1 and BB's<=5 then true)

Is this now even possible?
denutza
 
Posts: 105
Joined: Fri May 23, 2008 2:01 am

Re: help writing tourn stat to group stacks into # of BB's

Postby WhiteRider » Sat Aug 08, 2009 4:32 am

It sounds like you want to use this stat in the HUD?
This isn't really possible because stats used in the HUD are based on the totals of all hands played previously, not the current hand.
However, Kraada has been doing some work on a 'live' M stat (Harrington's "M" = your stack size divided by BB+SB+antes) which I think he's hoping to publish in the next couple of weeks.
WhiteRider
Moderator
 
Posts: 54025
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: help writing tourn stat to group stacks into # of BB's

Postby denutza » Sat Aug 08, 2009 7:52 am

No I wanted to use it for custom reports.
Past hands is what im looking for.
denutza
 
Posts: 105
Joined: Fri May 23, 2008 2:01 am

Re: help writing tourn stat to group stacks into # of BB's

Postby WhiteRider » Sat Aug 08, 2009 12:33 pm

OK - there is an 'M' stat available for download from the Repository.
This won't do exactly what you want - it sounds like you want to group stats based on your starting stack? - but it might be useful for reference.

So I guess you want this report to be in the Holdem Tournament Player Statistics section?
Build a column with this expression:
round( tourney_holdem_hand_player_detail.amt_before / tourney_holdem_blinds.amt_bb )
..and tick the "Group By" option, then create a stat to display this.
If you add this to a report it will show a row for each whole number of BB starting stack size.
If you want to open up the ranges you'll need to have a play around with the mathematical functions in postgres (http://www.postgresql.org/docs/8.3/static/functions-math.html) or use some IF statements.
If you can't work out how to do that let us know what divisions you want and we'll write the expression for you.
WhiteRider
Moderator
 
Posts: 54025
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: help writing tourn stat to group stacks into # of BB's

Postby denutza » Sat Aug 08, 2009 6:30 pm

WhiteRider wrote:So I guess you want this report to be in the Holdem Tournament Player Statistics section?
Build a column with this expression:
round( tourney_holdem_hand_player_detail.amt_before / tourney_holdem_blinds.amt_bb )
..and tick the "Group By" option, then create a stat to display this.


Ok, I assumed I click the "Group By" SUM feature. (I tried it a few other ways as well)

Logically this seems like a good first step:

amt_before= My Starting Stack
amt_bb= Size of the BB

round(StartingStack/SizeofBB)= # of BB's in my starting stack(which is what i want)

However, I don't think its working as most of the results dislayed in report are in the thousands
or tens of thousands.
denutza
 
Posts: 105
Joined: Fri May 23, 2008 2:01 am

Re: help writing tourn stat to group stacks into # of BB's

Postby WhiteRider » Sun Aug 09, 2009 4:37 am

Yes, check 'Group By' and leave the Summary Type as 'Sum', but do NOT include SUM in the expression - just enter it exactly as I wrote it above.

The stat I built is attached so if you can't get your own working you can import this - if you do, please have a look at how it is built so you can see what I've done differently.
Attachments
Stack Size.zip
(453 Bytes) Downloaded 161 times
WhiteRider
Moderator
 
Posts: 54025
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: help writing tourn stat to group stacks into # of BB's

Postby denutza » Sun Aug 09, 2009 3:50 pm

Ok well mine was working.

So this somehow just shows the starting stack?

If I started hand with 10,000 (this is what is showing up), and say Blinds are 500-1000
How do I get # of BB's ?


10,000/1000 would be 10.

I wouldve thought that function would display 10. But its just showing 10,000
denutza
 
Posts: 105
Joined: Fri May 23, 2008 2:01 am

Re: help writing tourn stat to group stacks into # of BB's

Postby WhiteRider » Sun Aug 09, 2009 4:38 pm

That's what my stat is showing me - the number of BBs.
Have you tried importing it and seeing if it's different to yours?
WhiteRider
Moderator
 
Posts: 54025
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: help writing tourn stat to group stacks into # of BB's

Postby denutza » Mon Aug 10, 2009 1:03 am

WhiteRider wrote:That's what my stat is showing me - the number of BBs.
Have you tried importing it and seeing if it's different to yours?


I have used yours and am getting the same result when I create a report.

I select NEW report, then add the Stack Size stat, and it displays the actual stack sizes only.
denutza
 
Posts: 105
Joined: Fri May 23, 2008 2:01 am

Re: help writing tourn stat to group stacks into # of BB's

Postby denutza » Mon Aug 10, 2009 1:17 am

When I add the Hands stat to the report it works.
denutza
 
Posts: 105
Joined: Fri May 23, 2008 2:01 am

Next

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

Who is online

Users browsing this forum: No registered users and 3 guests