Format Expression for Custom Statistic

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

Format Expression for Custom Statistic

Postby ChicagoAl » Thu Jan 06, 2011 2:41 pm

I am using the following expression for a custom statistic:

if(cnt_range_Raise_AA > 0, format('AA: {1}', format_number(cnt_range_Raise_AA, 0, false, true)),'')

If I understand the way this works correctly, if the value of cnt_range_Raise_AA is 9, i should get output something like this: "AA: 9" where the "AA" is in white and the "9" is in green. What I'm actually getting is the entire string "AA: 9" in green.

Am I using the format_number function incorrectly, is it not working properly, or am I using the wrong approach entirely?

Al
ChicagoAl
 
Posts: 29
Joined: Thu Aug 05, 2010 10:31 am

Re: Format Expression for Custom Statistic

Postby WhiteRider » Thu Jan 06, 2011 3:53 pm

I don't think that you can colour only part of a stat - I haven't found a way to do it anyway.
WhiteRider
Moderator
 
Posts: 54025
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Format Expression for Custom Statistic

Postby ChicagoAl » Thu Jan 06, 2011 4:00 pm

Thanks, WhiteRider. Does it seem strange to you that the format_number function is acting on text outside of the function? What would happen if I had two format_number functions in one argument, and one returned positive and the other negative?
ChicagoAl
 
Posts: 29
Joined: Thu Aug 05, 2010 10:31 am

Re: Format Expression for Custom Statistic

Postby WhiteRider » Thu Jan 06, 2011 4:09 pm

I'm not sure what would happen if you had a true and a false - I suspect that any true will colour it.
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 14 guests