Read based stat, some questions

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

Read based stat, some questions

Postby pasita » Sat Mar 26, 2011 2:39 pm

Ok, creating a read-based stat. Basically worked just as described in the tutorial. Some issues, though.

Value expression:
(cnt_p_limp_raise / cnt_p_limp_faceraise) * 100
Format expression:
if(cnt_p_limp_raise > 0,
format('LimpRaised {1}', format_number(cnt_p_limp_raise , 0, false, false)), '')

1: Is the Value expression actually used anywhere, other than showing the times/opportunities in the tooltip? Should the Format expression always override it?
2: If I have 0 opportunities, the stat will display a - which I don't like, I assume it's because of the value expression. With more than 0 opportunities the if-clause from the Format kicks in and displays zero. Is there a way to overcome this? I tried putting an if clause to the Value expression (if (cnt_p_limp_faceraise>0,...) but then I lose the times/opportunities which I'd like to keep.
3: Is there a way of adding a newline to the stat itself? I tried format('LimpRaised {1}\n' ...) with obviously no luck. I'd rather not use the newline in the HUD editor if possible, so the height of the stat box doesn't grow if no "reads".
4: Is there a way to refer to another statistic in the format expression? Tried if (#Hands# > 100, ....) with no luck (it validates though).
pasita
 
Posts: 605
Joined: Tue May 06, 2008 4:05 pm

Re: Read based stat, some questions

Postby WhiteRider » Sat Mar 26, 2011 4:25 pm

1. The value expression is used for sorting columns in reports, and (IIRC) for colouring stats in the HUD, but the only value that is displayed should be the format expression.

2. You could try rearranging your format expression a little, so that the IF is inside the format, although it makes it a little more complicated when you want conditional text too:
format( '{1}{2}', if(cnt_p_limp_raise > 0, 'LimpRaised ', ''), if(cnt_p_limp_raise > 0, format_number(cnt_p_limp_raise , 0, false, false), '')
I'm not sure whether that will override the "no opportunities" text, though, and I can't test it just now.

3. I don't think you can - stats are designed to be single line.

4. I'm not absolutely sure without checking, but I wouldn't expect that to work. You will need to either use the columns (i.e. copy the value expression of the other stat) or set up a Variable to hold the value and use that.
WhiteRider
Moderator
 
Posts: 54025
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Read based stat, some questions

Postby pasita » Sat Mar 26, 2011 5:14 pm

1: OK that makes sense.
2: Didn't notice any change when tried that way. I guess I can live with that.

Thanks.
pasita
 
Posts: 605
Joined: Tue May 06, 2008 4:05 pm

Re: Read based stat, some questions

Postby Lythande71 » Sat Mar 26, 2011 5:46 pm

ad 4)

Try cnt_hands instead of #Hands#
if(cnt_hands > 100, do this, else do that)
Lythande71
 
Posts: 33
Joined: Thu Jul 31, 2008 10:28 am

Re: Read based stat, some questions

Postby pasita » Sat Mar 26, 2011 6:38 pm

Yeah, the hands was just an example... but duplicating the expression from the stat I need should work, it'll just make things more messy with complex stats.

EDIT: Ok not really, they're mostly just percentages after all.
pasita
 
Posts: 605
Joined: Tue May 06, 2008 4:05 pm


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

Who is online

Users browsing this forum: No registered users and 0 guests