Sorting on code

anand_sri12
Member Posts: 71
I want to sort my report based on a key which is a code data type
but the report didnt sort the report as desired
the code value is in sequence of
e.x. - 1,2,3,5,100,101,102,199,213
the report shows like this
code
1
100
101
102
199
2
213
and so
what to do to sort the report correctly
but the report didnt sort the report as desired
the code value is in sequence of
e.x. - 1,2,3,5,100,101,102,199,213
the report shows like this
code
1
100
101
102
199
2
213
and so
what to do to sort the report correctly
With thanks
Anand Kumar
Navision Technical Consultant
Anand Kumar
Navision Technical Consultant
0
Answers
-
It looks to me as if you are storing your code in a Text field and not a Code field.0
-
MTC wrote:It looks to me as if you are storing your code in a Text field and not a Code field.
There is a property "SQLDataType" that you can change to integer so the code-field is sorted as an integer. BUT you CANNOT put codes anymore that are not integers. And everywhere you use that field you should change the SQLDataType.
Maybe better to read the data, put them in a temptable, put some '0' before them so each code has the same size (001,002,100,...) and then read the temptable to print the records.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
kriki wrote:MTC wrote:Maybe better to read the data, put them in a temptable, put some '0' before them so each code has the same size (001,002,100,...) and then read the temptable to print the records.
I think It is much better option
I cant change data type since there is loads of data in the table
if there is no other way i ll have to make a lot of changes in my report.
i think the topic should remain open coz there can be other solution for
the problemWith thanks
Anand Kumar
Navision Technical Consultant0 -
You could consider this. I haven't tried it, but it makes sense.
- Create an extra data-item based on Integer, ranging from 1 to the length of your code field.
- OnAfterGetRecord: build a string containing questionmarks.
The first time it should be '?', the 2nd time '??', then '???' etc.
- Use SETFILTER on your other data-item on the codefield with this string.
If you already have filters there, you could use another FILTERGROUP.
It might cost to much performance, though.Keep It Simple and Stupid (KISS), but never oversimplify.0 -
Krikis temp table is the way to go.0
-
kriki wrote:MTC wrote:It looks to me as if you are storing your code in a Text field and not a Code field.
There is a property "SQLDataType" that you can change to integer so the code-field is sorted as an integer. BUT you CANNOT put codes anymore that are not integers. And everywhere you use that field you should change the SQLDataType.
Maybe better to read the data, put them in a temptable, put some '0' before them so each code has the same size (001,002,100,...) and then read the temptable to print the records.
How does that work with the G/L account then on SQL? Sorry, I don't really touch these things apart from doing upgrades, but for example, in the W1 G/L account, the key is CODE, in the Spanish version it's TEXT, so the sorting is totally different. I only know this from an upgrade of a vertical I did from W1 to ES. Somehow on the first pass it remained as CODE when it should have been TEXT (my fault). Basically the G/L Account didn't work as it should have done.0 -
Sorry Kriki, didn't rea you post fully.
It's a bit of pain in the bum isn't it to have to go and set this SQLDataType thing. I really didn't realise about this, but I suppose I have to study more the differences between W1 and ES. It's not documented very well however where these things are different.0 -
Using the temp table code/text values could be first evaluated to int datatype, sorted and then do the actual report processing.0
-
MTC wrote:kriki wrote:MTC wrote:It looks to me as if you are storing your code in a Text field and not a Code field.
There is a property "SQLDataType" that you can change to integer so the code-field is sorted as an integer. BUT you CANNOT put codes anymore that are not integers. And everywhere you use that field you should change the SQLDataType.
Maybe better to read the data, put them in a temptable, put some '0' before them so each code has the same size (001,002,100,...) and then read the temptable to print the records.
How does that work with the G/L account then on SQL? Sorry, I don't really touch these things apart from doing upgrades, but for example, in the W1 G/L account, the key is CODE, in the Spanish version it's TEXT, so the sorting is totally different. I only know this from an upgrade of a vertical I did from W1 to ES. Somehow on the first pass it remained as CODE when it should have been TEXT (my fault). Basically the G/L Account didn't work as it should have done.
1
10
100
11
110
2
...
Also the Belgian DB used this in 2.XX. (And I suppose it still does).Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!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