This topic is locked

Sorting problem

3/13/2009 1:35:31 PM
PHPRunner General questions
D
Denton author

Hi.

I need to sort some data by it's numerical value, but I want 0 (zero) to be last.
I currently get:
0

1

2

3

4

5
when i want:
1

2

3

4

5

0
I am sure this is an easy fix, but being a newbie I can't figure it out.
Thnx

Den Ton

R
randall 3/13/2009

You can't do that unless you write your own sort routine. I'm not sure where you are in your project, but I'd suggest re-examining your database structure. Maybe you're using 0 when you'd be better off using NULL. Good luck.

D
Denton author 3/14/2009

You can't do that unless you write your own sort routine. I'm not sure where you are in your project, but I'd suggest re-examining your database structure. Maybe you're using 0 when you'd be better off using NULL. Good luck.


Thanks for hint. The 1,2,3 etc. represent finishing positions. "0" means nowhere or unplaced (ie. 6th or worse). If I put "null" for 6th and worse positions, how do I show these as "0" in the web output?
Denton

J
Jane 3/16/2009

Hi,
you can check value and change output on the "View as" settings --> Custom dialog on the Visual Editor tab.

Here is a sample:

if (!$value)

$value = 0;