Discuss how to create custom stats, reports and HUD profiles and share your creations.
Moderators: WhiteRider, kraada, Flag_Hippo, morny, Moderators
by 4StarGen » Sun Oct 07, 2018 12:17 pm
I'd like to retrieve all hands id, which a condition is verified...
I tried the code below but failed, why?
- Code: Select all
string_agg(CASE WHEN cash_hand_player_statistics.id_holecard =26 THEN cash_hand_player_statistics.id_hand ELSE NULL END, ',')
-
4StarGen
-
- Posts: 928
- Joined: Sat Mar 08, 2014 6:58 am
-
by WhiteRider » Mon Oct 08, 2018 3:48 am
This works for me:
- Code: Select all
select string_agg( id_hand::text, '|' ) from cash_hand_player_statistics where id_holecard=26
Bear in mind this is the hand ID (the database's internal ID for the hand), not the "hand number" that the site uses and you see in reports. Is that what you want?
-
WhiteRider
- Moderator
-
- Posts: 53961
- Joined: Sat Jan 19, 2008 7:06 pm
- Location: UK
by 4StarGen » Mon Oct 08, 2018 4:03 am
Yes since hand ID contains the exact position of the hand in the DB. What I'd like to do is to basically export it to excel to display a graph and display with a dot where the condition apply
-
4StarGen
-
- Posts: 928
- Joined: Sat Mar 08, 2014 6:58 am
-
by 4StarGen » Fri Oct 12, 2018 8:03 am
Sorry for posting up again, I saw your code is a simple SQL code and it works on pgadming I think but not in PT4. What I'm looking for is the id_hands as text in a custom stat.
Regarding my code above why it failes while if I use a lookup table it works? For example the code below works
- Code: Select all
string_agg(CASE WHEN cash_hand_player_statistics.enum_r_4bet_action='C' THEN lookup_actions_p.action ELSE NULL END, ',')
-
4StarGen
-
- Posts: 928
- Joined: Sat Mar 08, 2014 6:58 am
-
by WhiteRider » Fri Oct 12, 2018 12:22 pm
id_hand is an integer not text, so you'll need to cast it as text - that may be all you need to do. It took me a while to get anywhere with this expression and once I got the casting part sorted I didn't think to go back and try that in your original expression.
-
WhiteRider
- Moderator
-
- Posts: 53961
- Joined: Sat Jan 19, 2008 7:06 pm
- Location: UK
by 4StarGen » Fri Oct 12, 2018 7:23 pm
ty
-
4StarGen
-
- Posts: 928
- Joined: Sat Mar 08, 2014 6:58 am
-
Return to Custom Stats, Reports and HUD Profiles
Users browsing this forum: No registered users and 33 guests