custom stats if(exp, then, else)

Forum for users that want to write their own custom queries against the PT database either via the Structured Query Language (SQL) or using the PT3 custom stats/reports interface.

Moderator: Moderators

custom stats if(exp, then, else)

Postby elr18 » Sat Aug 30, 2008 12:24 pm

hi! im working on a custom stat and i was wondering if there was a way to add 2 if(exp , then, else) expressions together like this :
if(exp , then, else) + if(exp , then, else) . the 2 expressions work well alone but when i addition them together i never seem to get the rights results. i also seem to get trouble with : if(exp , then, else) + x when the if expression is negative : ex.: if the if expression is worth -2 : if(exp , then, else) + 5 , i get 4 as a result
thank you!
elr18
 
Posts: 8
Joined: Sat Aug 30, 2008 12:10 pm

Re: custom stats if(exp, then, else)

Postby WhiteRider » Sat Aug 30, 2008 1:06 pm

Try putting them in brackets:

( if(exp , then, else) ) + ( if(exp , then, else) )

I'm not sure that will work, but it's worth a shot.

If not you will have to do something like
if( exp1, if(exp2, then1+then2, then1), if(exp2,then2,0) )
WhiteRider
Moderator
 
Posts: 54025
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK


Return to Custom Stats, Reports, and SQL [Read Only]

Who is online

Users browsing this forum: No registered users and 11 guests