max(sum(expr))

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

Moderators: WhiteRider, kraada, Flag_Hippo, morny, Moderators

max(sum(expr))

Postby 9ae6 » Fri Jul 24, 2020 7:50 pm

Hello,

I would like to use max function with sum(cash_hand_player_statistics.amt_won) then I have tried :
max(sum(cash_hand_player_statistics.amt_won)) but it is not a valid SQL as you can see in my attached  files.

How can I do it please ^^,

Best regards,
9ae6
Attachments
max_amt_won.jpg
9ae6
 
Posts: 32
Joined: Mon Jul 23, 2012 6:28 am

Re: max(sum(expr))

Postby WhiteRider » Sat Jul 25, 2020 3:54 am

What exactly are you trying to do here? "Sum" creates a single value (the total across all hands) so there is no "max" of that.
If you want to find the highest amount won in a single hand then you can just use:

max( cash_hand_player_statistics.amt_won )
WhiteRider
Moderator
 
Posts: 54017
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: max(sum(expr))

Postby 9ae6 » Sat Jul 25, 2020 12:04 pm

I am trying to create a loss limit indicator that tells me when to quit the game.
Then I don't want the highest amount won in a single hand

but

really the highest amount won from "net result" ( then the max after the sum of all amount won)


Any ideas?

Best regards,
9ae6
9ae6
 
Posts: 32
Joined: Mon Jul 23, 2012 6:28 am

Re: max(sum(expr))

Postby WhiteRider » Sat Jul 25, 2020 5:42 pm

So you want to know the most you were up in the session? I'm not sure how to do that I'm afraid. It may be possible, but it would need a pretty advanced expression I think, and it's beyond my PostgreSQL ability.
WhiteRider
Moderator
 
Posts: 54017
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: max(sum(expr))

Postby 9ae6 » Sun Jul 26, 2020 6:00 am

So you want to know the most you were up in the session?

Exactly

For example :
With loss limit = 100$
If I go up to +300$ and after I go down to +200$ then I leave the game because (300 - 200 = 100) I have lost 100$ from highest point.
If I go up to +80$ .....................................-20$ ......................................................(+80 - (-20) = 100)....................
etc.
9ae6
 
Posts: 32
Joined: Mon Jul 23, 2012 6:28 am

Re: max(sum(expr))

Postby WhiteRider » Sun Jul 26, 2020 8:49 am

Thanks for clarifying. I do not know how to do that I'm afraid, but one of the PostgreSQL experts on the forum may be able to help you.
WhiteRider
Moderator
 
Posts: 54017
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: max(sum(expr))

Postby 9ae6 » Sun Jul 26, 2020 12:02 pm

but one of the PostgreSQL experts on the forum may be able to help you.

Thanks so how can I contact him?
9ae6
 
Posts: 32
Joined: Mon Jul 23, 2012 6:28 am

Re: max(sum(expr))

Postby WhiteRider » Sun Jul 26, 2020 1:40 pm

A few users of this forum are very good at PostgreSQL and if one of them sees this they may be able to help, but I didn't mean anyone specific, sorry for the confusion.

That data isn't stored in the database directly so it would take an advanced query to calculate it, if it is even possible.
WhiteRider
Moderator
 
Posts: 54017
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: max(sum(expr))

Postby 9ae6 » Sun Aug 02, 2020 8:59 am

Hello,

Finally I have found myself. It is not 100% perfect because

Code: Select all
cash_hand_player_statistics.amt_before


without "max" is not cacheable then I have found another solution that works 99%.
Indeed if I not leave the game when I reach the loss limit and after I win a lot of money then the color stay "red". It is better than nothing.

Here my method to do it :

1°/I create the column "amt_max_stack_bb" with the expression :
Code: Select all
max(cash_hand_player_statistics.amt_before / cash_limit.amt_bb)


2°/I create the stat "max_stack_bb" with the expression :
Code: Select all
amt_max_stack_bb

3°/I create the stat "net_result" with the expression :
Code: Select all
amt_won

4°I create the stat "net_result_bb" with the expression
Code: Select all
amt_bb_won


4°/ Now in the section color condition of the stat "net_result", I need to compare money with money then I put:

RED :
Code: Select all
#net_result_bb# <= #max_stack_bb# - 200
(200 because I buyin 100bb and I want a 100bb loss limit then -100 -100 = -200. If you want a 200bb loss limit then put -300 because -100 -200 = -300 etc)

YELLOW :
Code: Select all
#net_result_bb# < 0


GREEN
Code: Select all
#net_result_bb#  > 0


My main problem is that I can not do so much since
Code: Select all
cash_hand_player_statistics.amt_before
is not cacheable.

So if someone has an idea to do it cacheable or another method to have a loss limit please let us know that would be cool 8-)


Best regards,
9ae6
Attachments
losslimit.jpg
losslimit
9ae6
 
Posts: 32
Joined: Mon Jul 23, 2012 6:28 am


Return to Custom Stats, Reports and HUD Profiles

Who is online

Users browsing this forum: No registered users and 10 guests

cron
highfalutin