Discuss how to create custom stats, reports and HUD profiles and share your creations.
Moderators: WhiteRider, kraada, Flag_Hippo, morny, Moderators
by wallacedavidl » Mon Nov 18, 2024 11:09 am
Hey Team -
I've been using nested IF statements to build stats. Is there a way for me to use a SQL CASE statement? And if so, can you please provide an example?
Thanks, David
-
wallacedavidl
-
- Posts: 67
- Joined: Sat Aug 03, 2024 4:37 pm
by wallacedavidl » Mon Nov 18, 2024 7:45 pm
Thanks. The first article has a great complex example. I need to run some tests. Thanks again. I think you can close this one out;
-
wallacedavidl
-
- Posts: 67
- Joined: Sat Aug 03, 2024 4:37 pm
by wallacedavidl » Thu Dec 05, 2024 6:54 pm
i'm successfully using CASE statements that return Integers such as the following:
SUM(CASE
WHEN
f_good
THEN 1
WHEN
f_bad
THEN 2
WHEN
f_ugly
THEN 3
ELSE 0 END)
I'm having an issue when I want to return a text string:
SUM(CASE
WHEN
f_good
THEN 'good'
WHEN
f_bad
THEN 'bad'
WHEN
f_ugly
THEN 'ugly'
ELSE '-' END)
OR...
SUM(CASE
WHEN
f_good
THEN format('good')
WHEN
f_bad
THEN format('bad')
WHEN
f_ugly
THEN format('ugly')
ELSE format('-') END)
What am I doing wrong?
Thanks,
David
-
wallacedavidl
-
- Posts: 67
- Joined: Sat Aug 03, 2024 4:37 pm
by Flag_Hippo » Fri Dec 06, 2024 7:35 am
What exactly are you trying to achieve here as an end result and why are you using SUM? What is f_good, f_bad and f_ugly? Without context, specific details and expressions it's difficult to give relevant advice. Presumably you are trying to group data with a custom statistic in a player report by certain board textures? For that you can build a custom column for the groupings you want and then you can do the text formatting in the statistic itself. Look at the built-in statistic 'Flop Bet Size' for an example of this type of statistic.
-
Flag_Hippo
- Moderator
-
- Posts: 15262
- Joined: Tue Jan 31, 2012 7:50 am
by wallacedavidl » Fri Dec 13, 2024 3:07 pm
Hey, Team -
What I want to achieve is to have the THEN return a Text String.
-
wallacedavidl
-
- Posts: 67
- Joined: Sat Aug 03, 2024 4:37 pm
by Flag_Hippo » Sun Dec 15, 2024 6:11 am
That doesn't answer my questions but depending on what you want as an end result in PokerTracker 4 you can format the text output in the statistic and not the column. Presumably you are trying to group data with a custom statistic in a player report by certain board textures? For that you can build a custom column for the groupings you want and then you can do the text formatting in the statistic itself. Look at the built-in statistic 'Flop Bet Size' for an example of this type of statistic.
-
Flag_Hippo
- Moderator
-
- Posts: 15262
- Joined: Tue Jan 31, 2012 7:50 am
by wallacedavidl » Mon Dec 16, 2024 12:51 pm
Hey, Team -
I understand you can use format ('Text String') in an IF statement as shown in the example you provided. But when I try and use format ('Text String') in a CASE statement within a Statistic, PT4 returns an error. Do you have an example of a CASE statement within a Statistic that returns a Text String in the same way that an IF statement does?
Thanks,
David
-
wallacedavidl
-
- Posts: 67
- Joined: Sat Aug 03, 2024 4:37 pm
by Flag_Hippo » Mon Dec 16, 2024 1:23 pm
No I don't have an example although I still don't know exactly what you are trying to achieve as an end result in PokerTracker 4. As I have been asking in previous posts are you trying to group data with a custom statistic in a player report by certain board textures? Or are you trying to do something else? Please provide more context and specific details about what you want this statistic to do in PokerTracker 4. Thank you.
-
Flag_Hippo
- Moderator
-
- Posts: 15262
- Joined: Tue Jan 31, 2012 7:50 am
by WhiteRider » Tue Dec 17, 2024 5:45 am
wallacedavidl wrote:Hey, Team -
I understand you can use format ('Text String') in an IF statement as shown in the example you provided. But when I try and use format ('Text String') in a CASE statement within a Statistic, PT4 returns an error. Do you have an example of a CASE statement within a Statistic that returns a Text String in the same way that an IF statement does?
Thanks,
David
If you are still trying to use the "SUM" around your expression that will not work with strings. You cannot sum (add up) string values.
-
WhiteRider
- Moderator
-
- Posts: 54018
- Joined: Sat Jan 19, 2008 7:06 pm
- Location: UK
Return to Custom Stats, Reports and HUD Profiles
Users browsing this forum: Matt21, WhiteRider and 43 guests