Min() use in columns

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

Min() use in columns

Postby ChicagoAl » Mon Jan 10, 2011 7:41 pm

So I want to create a Column expression which counts a number of actions, but with a maximum value. For example, if I wanted to create a column that simply counted the number of times a player limped preflop, I would use the following:

sum(if[tourney_holdem_hand_player_statistics.flg_p_limp, 1, 0])

I haven't been able to figure out how to store the lesser of the number of limps or, say, the value 999 - so that the number stored in the column would never reach or exceed 1000. I was hoping that the min() function would help me here, but the following statement returns invalid by the PT3 Configure Statistics UI:

min(sum(if[tourney_holdem_hand_player_statistics.flg_p_limp, 1, 0]),999)

Is there a way to accomplish this?

Thanks - and sorry for bugging you guys so much!

Al
ChicagoAl
 
Posts: 29
Joined: Thu Aug 05, 2010 10:31 am

Re: Min() use in columns

Postby kraada » Mon Jan 10, 2011 7:47 pm

I don't believe that is going to work, but you can display a maximum if you want in the format expression of a custom stat if you'd like. For example you could use:
if(cnt_p_limp < 999, format_number( (cnt_p_limp / cnt_hands) * 100, 0, false, false), 'Limps a lot!')

That would display the player's limp percentage if they'd limped less than 999 times, or "Limps a lot!" if they limped more than that.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Min() use in columns

Postby ChicagoAl » Mon Jan 10, 2011 7:51 pm

Thanks Kraada - I did figure out how to do it at display time. What I'm trying to accomplish really requires that I store it with the max value in the column though. No way you can think of to cap the value stored?
ChicagoAl
 
Posts: 29
Joined: Thu Aug 05, 2010 10:31 am

Re: Min() use in columns

Postby WhiteRider » Tue Jan 11, 2011 4:19 am

I don't think he can do that either. I've thought about this sort of thing in the past and not come up with a solution.
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