This topic is locked

Formatting Numbers In Visual Editor Average Field

12/5/2006 10:47:24 AM
PHPRunner General questions
J
jebrown author

I customized a field Average in the Visual Editor by using the following:
<TD class=blackshade>Cumulative Average: {$showtotal_Miles_Ridden/$showtotal_Max_Number_of_Days}</TD>
PHPRunner currently displays the number with 12 decimal points and when I click on the cell's Properties, nothing is displayed so I am unable to format it within the Visual Editor. Is there another way for me to format the number so that it has 2 decimal places?

Alexey admin 12/6/2006

Hi,
I recommend you to do the following:

  1. Replace the snippet you modified with this one:
    <TD class=blackshade>Cumulative Average: {$mytotal}</TD>



2. Put this code into List OnLoad event:

global $smarty;

$mytotal= $smarty->get_template_vars("showtotal_Miles_Ridden") / $smarty->get_template_vars("showtotal_Max_Number_of_Days");

$smarty->assign("mytotal",round($mytotal,2));

J
jebrown author 12/6/2006

That solved the problem! Thanks for the great technical support.

Hi,

I recommend you to do the following:

  1. Replace the snippet you modified with this one:
  2. Put this code into List OnLoad event: