Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting 1 to 01, etc.

Status
Not open for further replies.

Lanie

Programmer
Jan 20, 2000
83
US
Hi,
I've got a report, grouped by a project#, that has several lines in the detail sections. The fields are Line Number, Part Number, Description etc.

The data in the Line number field is 1,2,3,4,5,6,7,8,9,10,11,12 respectively. sorted ascending. So whats my problem?

Well I need to have 10, 11, 12 follow 9. What I am getting is 1,10,11,12,2,3 etc. I have no control over the table at all (third party thing) and must function within their paramaters for this.

Does anyone know how i would convert 1 to 01, 2 to 02, 3 to 03 etc. so that it will sort and thus print correctly?

I really appreciate your help. Thank you, Lanie
Lanie
etroidl@conaxfl.com

 
Hi Lanie this is a common problem when sorting string numbers.

My approach to this is to create a grouping formula. This formula is not used for display...unless you want to...the real values will be displayed as normal. In this case, simply convert the string to a number

@grouping

tonumber({table.lineNumber});

It is a little more tricky if there is mixed alpha-numeric...then I set a maximum size for the string and pad the left side of the value with " " or a more appropriate character to give all the same relative look.



JimBroadbent@Hotmail.com

Reward good advice with a star, it reinforces us and helps others find answers to their problems.
 
Okay, guess I'm not getting this one.
I made the formula @group and then set it to change the field to a number: tonumber({table.lineNumber});

It returned a no error message, so I saved and closed. I refreshed the report, but the line numbers are still coming up like this:

1
11
2
3
4
etc.

Guess I'm pretty thick, what did I do wrong?
Lanie
Lanie
laniet@ij.net
etroidl@conaxfl.com


 
did you form a group on this formula and set it for ascending???

nothing can happen til you form a group using the formula...the formula just sits there...if you are already grouped on {table.lineNumber} then in the grey margin...right click on the group and select "change group"...form the dialog box choose the formula @grouping and set it to ascending...close and you should be in business.

JimBroadbent@Hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top