Native to SQL ... now records not FILTERing in proper order!

ecarmody
Member Posts: 53
Hello,
We've always been using a CODE (10) type field on a table that holds basically what is a order number. We have two types of orders where one type is in range 1,000,000 to 9,999,999 and the other type is ranged 99,999,999 and greater.
No comma's ... I'm just showing them for clarity of the numeric value.
Problem. Since converting to SQL, they do not sort like a numeric sequence anymore. I see the table in the SQL has defined the field a VARCHAR, so now they sort left to right alphanumerically. So, 4,000,000 sorts AFTER 33,000,000 !!!
Can I achieve a sort using the SETFILTER or SETRANGE so I get the orders greater than 9,999,999 ?
I haven't figured out a way to use a function in the SETFILTER or SETRANGE command, such as filtering where STRLEN(no) > 7; or perhaps padding with leading zeros, where 04000000 would be less than 33000000.
Any help would be very apprecated.
Cheers,
Eric
We've always been using a CODE (10) type field on a table that holds basically what is a order number. We have two types of orders where one type is in range 1,000,000 to 9,999,999 and the other type is ranged 99,999,999 and greater.
No comma's ... I'm just showing them for clarity of the numeric value.
Problem. Since converting to SQL, they do not sort like a numeric sequence anymore. I see the table in the SQL has defined the field a VARCHAR, so now they sort left to right alphanumerically. So, 4,000,000 sorts AFTER 33,000,000 !!!
Can I achieve a sort using the SETFILTER or SETRANGE so I get the orders greater than 9,999,999 ?
I haven't figured out a way to use a function in the SETFILTER or SETRANGE command, such as filtering where STRLEN(no) > 7; or perhaps padding with leading zeros, where 04000000 would be less than 33000000.
Any help would be very apprecated.
Cheers,
Eric
0
Comments
-
Hi Eric,
Look at this Sorting Issues after conversion to SQL... version 4.0
Hope the link works if not look in the SQL General forum.
Albert0 -
ecarmody wrote:Hello,
We've always been using a CODE (10) type field on a table that holds basically what is a order number. We have two types of orders where one type is in range 1,000,000 to 9,999,999 and the other type is ranged 99,999,999 and greater.
No comma's ... I'm just showing them for clarity of the numeric value.
Problem. Since converting to SQL, they do not sort like a numeric sequence anymore. I see the table in the SQL has defined the field a VARCHAR, so now they sort left to right alphanumerically. So, 4,000,000 sorts AFTER 33,000,000 !!!
Can I achieve a sort using the SETFILTER or SETRANGE so I get the orders greater than 9,999,999 ?
I haven't figured out a way to use a function in the SETFILTER or SETRANGE command, such as filtering where STRLEN(no) > 7; or perhaps padding with leading zeros, where 04000000 would be less than 33000000.
Any help would be very apprecated.
Cheers,
Eric
To get around this, I 'd suggest to change the field property SQL Data Type to VARIANT, this will cover both.Torsten
MCP+I, MCSE NT, Navision MCT (2004,2005)0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions