>Hi all,
>
>I'm looking for advice, before i reinvent the wheel, about creating an index on an address field for a temporary table, so that PO boxes will sort by their numeric value, for instance:
>
>1234 Terrice Drive
>P. O. BOX 1
>P. O. BOX 3
>P. O. BOX 3 PPP
>P. O. BOX 3 Quartermaster Road
>P. O. BOX 4
>P. O. BOX 10
>
>etc.
>
>The PO Box addresses are guaranted to start with "P. O. BOX"
>
>I can sort properly all numeric only PO Box addressess, with:
>
>INDEX on IIF( mas_address1 = "P. O. BOX", "P. O. Box " + padl(INT(VAL(SUBSTR(mas_address1, 10))),10), mas_address1) TO testnew
>
>But the addresses with text after the number give me trouble.
>
>Anyone already doing this?
>
>TIA! J
INDEX on VAL(STRTRAN(mas_address1,"P. O. BOX","",1)) TO testnew