Column Condition in IF Statement

Discuss how to create custom stats, reports and HUD profiles and share your creations.

Moderators: WhiteRider, kraada, Flag_Hippo, morny, Moderators

Column Condition in IF Statement

Postby ccpsc » Fri Dec 30, 2022 9:00 pm

I am trying to create a Column to filter for the player as the last raiser preflop and continued on the flop to see the turn. So far I have been able to create "sum( if[ cash_hand_player_statistics.flg_p_first_raise AND cash_hand_player_statistics.flg_t_saw, 1, 0 ] )"

I can only find flag "cash_hand_player_statistics.flg_p_first_raise" for the first raise. If I use this one it will included hands where the player subsequently called a re-raise. I need to filter for the last raise so I only get hands where the player is the final raiser preflop.

Does anyone know how I might be able to do this?
ccpsc
 
Posts: 32
Joined: Wed Mar 19, 2008 7:45 pm

Re: Column Condition in IF Statement

Postby ccpsc » Sat Dec 31, 2022 6:07 pm

I need to clarify this statement "I need to filter for the last raise so I only get hands where the player is the final raiser preflop." it should say "I need to filter for where the player's last preflop action was a raise so I only get those hands."
ccpsc
 
Posts: 32
Joined: Wed Mar 19, 2008 7:45 pm

Re: Column Condition in IF Statement

Postby Flag_Hippo » Sun Jan 01, 2023 6:36 am

ccpsc wrote:it should say "I need to filter for where the player's last preflop action was a raise so I only get those hands."

To ensure the players last preflop action was a raise you can use this:

Code: Select all
lookup_actions_p.action LIKE '%R'
Flag_Hippo
Moderator
 
Posts: 14441
Joined: Tue Jan 31, 2012 7:50 am

Re: Column Condition in IF Statement

Postby ccpsc » Sun Jan 01, 2023 6:51 pm

Thanks for the response. Two more question, if the last action was a call or cold call would it be "lookup_actions_p.action LIKE '%C OR %CC'"? Also is there anywhere I can find a list of these variables?
ccpsc
 
Posts: 32
Joined: Wed Mar 19, 2008 7:45 pm

Re: Column Condition in IF Statement

Postby Flag_Hippo » Mon Jan 02, 2023 5:47 am

The players actions are stored in order for each street (F, C, R and/or X) and the type of call doesn't matter so if the players last preflop action was a call (limp, call or cold call) then it would be the same as raise but using C instead of R:

Code: Select all
lookup_actions_p.action LIKE '%C'

For more information on pattern matching in PostgreSQL see this guide.
Flag_Hippo
Moderator
 
Posts: 14441
Joined: Tue Jan 31, 2012 7:50 am

Re: Column Condition in IF Statement

Postby ccpsc » Tue Jan 03, 2023 5:30 pm

Thanks, I am getting closer to the results I am looking for. Other than LIKE what other operators can I use? Also can I nest conditions in IF statements? For example sum( if[ [ Condition1 OR Condition2 ] AND Condition3, 1, 0 ] ) does this work?
ccpsc
 
Posts: 32
Joined: Wed Mar 19, 2008 7:45 pm

Re: Column Condition in IF Statement

Postby Flag_Hippo » Wed Jan 04, 2023 6:46 am

ccpsc wrote:Thanks, I am getting closer to the results I am looking for. Other than LIKE what other operators can I use?

SIMILAR TO is also used for pattern matching - see this guide. For example:

Code: Select all
lookup_actions_f.action SIMILAR TO '(F|XF)'

To see a list of other operators used in custom statistics go to 'Configure -> Statistics', select a custom column and click the 'Insert' link.
ccpsc wrote:Also can I nest conditions in IF statements? For example sum( if[ [ Condition1 OR Condition2 ] AND Condition3, 1, 0 ] ) does this work?

Yes you can do that.
Flag_Hippo
Moderator
 
Posts: 14441
Joined: Tue Jan 31, 2012 7:50 am

Re: Column Condition in IF Statement

Postby ccpsc » Wed Jan 04, 2023 7:35 pm

I see the variable XF in '(F|XF)' above. I think I now see what you mean when you mentioned (F, C, R and/or X) earlier it means the variables are (F, XF, C, XC, R, XR, X). Are there other combos like RC or any other variables not listed?

To find the last action using SIMILAR TO (If it is possible) what is the correct format, is it '%(C|R)' or '(%C|%R)' or something else? I am unsure after reading "9.7.2. SIMILAR TO Regular Expressions" in the link in your previous post.
ccpsc
 
Posts: 32
Joined: Wed Mar 19, 2008 7:45 pm

Re: Column Condition in IF Statement

Postby Flag_Hippo » Thu Jan 05, 2023 7:04 am

ccpsc wrote:I see the variable XF in '(F|XF)' above. I think I now see what you mean when you mentioned (F, C, R and/or X) earlier it means the variables are (F, XF, C, XC, R, XR, X). Are there other combos like RC or any other variables not listed?

There are far more possible combinations of actions a player could take although a player can only check (X) as a first action or fold (F) as a final action on a given street. Of course there is 'RC' because if, for example, a player open raises on the button and then calls a 3bet from the big blind then the preflop actions the player took would be 'RC'. If a player limps preflop, 3bets vs a 2bet and then folds to an all-in then that players preflop actions for the hand are 'CRF'.
ccpsc wrote:To find the last action using SIMILAR TO (If it is possible) what is the correct format, is it '%(C|R)' or '(%C|%R)' or something else?

Those are both valid and do the same thing.
Flag_Hippo
Moderator
 
Posts: 14441
Joined: Tue Jan 31, 2012 7:50 am


Return to Custom Stats, Reports and HUD Profiles

Who is online

Users browsing this forum: sky44 and 30 guests

cron