using a new column in another new column

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

using a new column in another new column

Postby onaleeps » Thu Jan 29, 2009 2:11 pm

I wanted to create a new statistic which is: Percent of hands won after attempting a blind steal and defender didn't fold. So I first made a flag variable. I did this under the "Holdem Cash Hand" section name. The purpose of the flag was to flag hands in which a blind steal was attempted, but the defender didn't fold (he either called or raised). The variable was put in as a new column and it was called flg_steal_att_opp_nf. The expression to create it was:

if[holdem_hand_player_statistics.flg_steal_att AND (holdem_hand_player_statistics.flg_p_3bet_def_opp OR holdem_hand_player_statistics.flg_f_saw),1,0]

Then, I wanted to use my new flg_steal_att_opp_nf flag in the creation of another new column. This time, the new column was to go under "Holdem Cash Player Statistics" section name because it would be a count of all the times that a player attempted a steal but the defender didn't fold. I tried this expression:

sum(if[flg_steal_att_opp_nf,1,0])

That didn't work (I got an error in validating the expression).

So, I tried:

sum(if[holdem_hand_player_statistics.flg_steal_att_opp_nf,1,0])

That didn't work either. Can anybody give a hint as to how I can get the one column that I created under "Holdem Cash Hand" to be recognized when I'm creating another column under "Holdem Cash Player Statistics"?

Thank you,
onaleeps
onaleeps
 
Posts: 16
Joined: Sun Jan 25, 2009 2:54 am

Re: using a new column in another new column

Postby kraada » Thu Jan 29, 2009 2:37 pm

You can't cross the sections like that, I'm afraid.

What you'll want to do is create two columns in HCPS, one which counts all the times a player attempted to steal and were called, and the times they did that and won at showdown.

In the HCPS section:

cnt_steal_att_opp_no_instafold

sum(if[holdem_hand_player_statistics.flg_steal_att AND(holdem_hand_player_statistics.flg_p_3bet_def_opp OR holdem_hand_player_statsitics.flg_f_saw), 1, 0])

This one you pretty much had already.

Then:

cnt_steal_att_opp_no_instafold_win_showdown:

sum(if[holdem_hand_player_statistics.flg_steal_att AND(holdem_hand_player_statistics.flg_p_3bet_def_opp OR holdem_hand_player_statsitics.flg_f_saw) AND holdem_hand_player_statistics.flg_won_hand AND holdem_hand_player_statsitics.flg_showdown, 1, 0])

Put the latter over the former and multiply by 100 to get a percent in the stat's definition and you're good to go.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: using a new column in another new column

Postby onaleeps » Thu Jan 29, 2009 4:27 pm

Wow. That's great! Thank you!
onaleeps
 
Posts: 16
Joined: Sun Jan 25, 2009 2:54 am

Re: using a new column in another new column

Postby kraada » Thu Jan 29, 2009 4:58 pm

You're welcome; enjoy :)
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY


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

Who is online

Users browsing this forum: No registered users and 0 guests