Sorting Text Field with dashes

T

terryh70

I have a text field that contains the following values and sort in this order

138-1
138-10
138-11
138-12
138-2
138-20
138-21
138-22
138-3
138-4

I would like to have it sort this way

138-1
138-2
138-3
138-4
138-5
138-10
138-11
138-12
138-13
138-20
138-21
138-22
 
F

fredg

I have a text field that contains the following values and sort in this order

138-1
138-10
138-11
138-12
138-2
138-20
138-21
138-22
138-3
138-4

I would like to have it sort this way

138-1
138-2
138-3
138-4
138-5
138-10
138-11
138-12
138-13
138-20
138-21
138-22

In the report's Sorting and Grouping dialog:
View + Sorting and Grouping
as the first Field/Expression line write:

=Val(Left([FieldName],InStr([FieldName],"-")-1))
Ascending

On the next Field/Expression line, write

=Val(Mid([FieldName],InStr([FieldName],"-")+1))
Ascending
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top