Couple of Questions Regarding "format"

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

Couple of Questions Regarding "format"

Postby oracle3001 » Tue Dec 23, 2008 4:06 pm

I understand how to use format. What I am interested in to know why you have to define a stat in definition->value expression, and then if you want to format it do the same kind of thing in format->format expression.

What I mean is taking the example in the guide, you $/100

definition -> value expression:- amt_won / (cnt_hands / 100)

format -> format expression:- format_money(amt_won / (cnt_hands / 100), true)

This seems like a lot of duplication and I'm not sure why it would be the case. Is it not possible to define the stat in the value expression then in the format expression do something like the following

format_money(this,true) ;

or something similar.

I also noticed that straight forward stat wanting to be formatted to 2 D.P are formatted as /%.2f. I kind of understand this, but could you explain what the /% stands for. Also if it is possible to do this with a standard stat, how come for the above example it isn't something like

format_money(%,true)
oracle3001
 
Posts: 851
Joined: Fri Jan 25, 2008 4:12 am

Re: Couple of Questions Regarding "format"

Postby Josh » Fri Dec 26, 2008 11:28 am

I agree, there is unnecessary duplication. The value/format is required for a lot of internal processing, but with most stats the format will want to use the value. I'll see what I can do about this.
Josh
Site Admin
 
Posts: 6222
Joined: Sat Dec 08, 2007 6:03 pm


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

Who is online

Users browsing this forum: No registered users and 0 guests