Custum Sort with zero

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I create a custom listfor sorting where zero (0) is the last item on
the sort list. I cannot enter all the values since I do not know before hand
the range of number I will have to sort however, regardless of the range of
numbers I would like all records with a value of zero to be at the end of the
list after sorting.
 
Rafi said:
How do I create a custom listfor sorting where zero (0) is the last item on
the sort list. I cannot enter all the values since I do not know before hand
the range of number I will have to sort however, regardless of the range of
numbers I would like all records with a value of zero to be at the end of the
list after sorting.


Try sorting on an expression like:
IIf(item > 0, item, 999999999)
Or you could provide more details about the calues you are
sorting and where/how the sorting is performed.
 
How do I create a custom listfor sorting where zero (0) is the last item on
the sort list. I cannot enter all the values since I do not know before hand
the range of number I will have to sort however, regardless of the range of
numbers I would like all records with a value of zero to be at the end of the
list after sorting.

What's the datatype of the field? If it's Long Integer (the default
Number datatype), you can use the largest possible long integer: put a
calculated field in the table

SortKey: IIF([Fieldname] = 0, 2147483647, [Fieldname])

and sort by this field.

John W. Vinson[MVP]
 
I am sorting on a priority list (Integers) with some records having a
priority of zero or Null

John Vinson said:
How do I create a custom listfor sorting where zero (0) is the last item on
the sort list. I cannot enter all the values since I do not know before hand
the range of number I will have to sort however, regardless of the range of
numbers I would like all records with a value of zero to be at the end of the
list after sorting.

What's the datatype of the field? If it's Long Integer (the default
Number datatype), you can use the largest possible long integer: put a
calculated field in the table

SortKey: IIF([Fieldname] = 0, 2147483647, [Fieldname])

and sort by this field.

John W. Vinson[MVP]
 
I am sorting on a priority list (Integers) with some records having a
priority of zero or Null

Well, are they zero? or are they Null? These are DIFFERENT values.

Try sorting by

Iif(NZ([fieldname]) = 0, 2147483647, [fieldname])

or if the fields in fact contain either a long integer or a NULL, sort
by

NZ([fieldname], 2147483647)

John W. Vinson[MVP]
 
Back
Top