Using conditional dates in stat definition

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

Moderators: WhiteRider, kraada, Flag_Hippo, morny, Moderators

Re: Using conditional dates in stat definition

Postby COKE_MAN » Tue Feb 05, 2013 5:08 pm

Thanks for the reply.
I wanted a nested IF so I could put one rate on the dates before Feb 1 and one rate on the dates after. So given the last quoted expression, I would have to re-include the Crake calculation. Something like this:
sum(if[cash_hand_player_statistics.amt_bet_ttl > 0 AND cash_hand_summary.amt_rake > 0 AND cash_hand_player_statistics.date_played < '2013-02-02 00:00:00', cash_hand_summary.amt_rake * (cash_hand_player_statistics.amt_bet_ttl / cash_hand_summary.amt_pot) * .35, if[cash_hand_player_statistics.amt_bet_ttl > 0 AND cash_hand_summary.amt_rake > 0 , cash_hand_summary.amt_rake * (cash_hand_player_statistics.amt_bet_ttl / cash_hand_summary.amt_pot) * .14,0]])

That doesn't work though. Seems the nested IF breaks it.

What I have ended up doing is just making a series of columns for whatever date ranges I have with different RB/Reward amounts. Something like:
Column1 -
sum(if[cash_hand_player_statistics.amt_bet_ttl > 0 AND cash_hand_summary.amt_rake > 0 AND cash_hand_player_statistics.date_played < '2013-02-02 00:00:00', cash_hand_summary.amt_rake * (cash_hand_player_statistics.amt_bet_ttl / cash_hand_summary.amt_pot) * .35, 0])
Column2 -
sum(if[cash_hand_player_statistics.amt_bet_ttl > 0 AND cash_hand_summary.amt_rake > 0 AND cash_hand_player_statistics.date_played >= '2013-02-02 00:00:00', cash_hand_summary.amt_rake * (cash_hand_player_statistics.amt_bet_ttl / cash_hand_summary.amt_pot) * .35, 0])

Then I have a stat that just includes both. One or the other is always set to 0, so the calculation works over whatever date range I choose.
RBStat -
Column1+Column2

This is giving me the results I need and I will just have to create a new column and redo the Crake calc every time I need to add a date range.

I still wish I could figure out how to do this without having to manually offset my date by one. Any insight why the datefix functions throw an error when used in an IF statement in a column?
COKE_MAN
 
Posts: 125
Joined: Thu Mar 10, 2011 2:44 pm

Re: Using conditional dates in stat definition

Postby WhiteRider » Wed Feb 06, 2013 4:49 am

I'm not sure why the datefix causes a problem but I suspect it is related to how it is turned into SQL. I think it may need to be interpreted by PT4 before the expression is turned into SQL, and putting it inside the IF could be stopping that happening.
WhiteRider
Moderator
 
Posts: 54018
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Using conditional dates in stat definition

Postby COKE_MAN » Wed Feb 06, 2013 3:42 pm

That's what I suspect too. Do you see the issue on your end?
COKE_MAN
 
Posts: 125
Joined: Thu Mar 10, 2011 2:44 pm

Re: Using conditional dates in stat definition

Postby WhiteRider » Thu Feb 07, 2013 4:31 am

Yes. For now I think you will need to adjust the time you're comparing based on your offset from GMT.
WhiteRider
Moderator
 
Posts: 54018
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Previous

Return to Custom Stats, Reports and HUD Profiles

Who is online

Users browsing this forum: No registered users and 46 guests

cron
highfalutin