New Response
Cancel
Copy to Archive
Move to Archive
Document Library
Main Topic
Kurt Tomicich
2005/02/15
Procedure
Reference
Subject:
Column Sort - Numeric instead of Alpha
Category:
Tips\ Notes\ Programming
Version:
Revision Date:
2005/02/15
Modified:
2005/03/07
Reviewers
Originator
Previous
Current
Future
Kurt Tomicich
Kurt Tomicich/KRT
None
None
To convert a # only value to be sorted numberically and prevent errors if the field is empty:
realnum:=
@TextToNumber
(
fieldname
);
@If(
fieldname
=
""
;
" "
; realnum)
See the description for the following script for details
For a mixed # and alpha value that follows a set pattern, ie:
PDB-1, PDB-11, PDB-2
, use a delimiter like this:
textnum :=
@Right
(
fieldname
; "-");
realnum :=
@TextToNumber
(textnum);
@If(
fieldname
=
""
;
" "
; realnum)
The above code creates a variable "textnum" that is equal to everything to the right of the dash in field
fieldname
, then it creates a variable "realnum" that is equal to the value of the variable "textnum", converted to a number. Once all that is done, it tests to see if field
fieldname
is empty, if true the column displays a single space (null value producess an @Error, so it has to be at least a space) if false, the column displays the value of the variable "realnum"
Submitted for review on 2/15/2005
Review completed by Kurt Tomicich on 3/7/2005
All Documents
   
By Author
   
By Category
   
By Alternate Name
   
Review Status
   
Help