This topic is locked

Difference between two fields as a value

8/19/2007 2:59:58 PM
PHPRunner General questions
M
mmponline author

I need to show the difference if two fields as a value next to the score.

Eg.
Par: 72 Score: 74 Difference: +2

Par: 71 Score: 70 Difference: -1
Also, it would be great if the - (minus) scores are shown in another colour (Eg. red)
Can this be added as a code snippet on the list page.

J
Jane 8/20/2007

Stephan,
try to calcualate difference in the SQL query on the Edit SQL query tab:

select

Par,

Score,

Score-Par as Difference

from TableName

To highlight negative result on the list page use Custom option on the "View as" settings dialog on the Visual Editor tab for the Difference field:

if ($value>0)

$value = "+".$value;

else

$value = "<font color=red>-".$value."</font>";