15.10.2008, 02:05 | #1 |
Участник
|
Dynamics AX: Map Object Sorting - a real issue
Источник: http://dynamics-ax.blogspot.com/2008...eal-issue.html
============== Alright, So I am sure everyone has used Map objects in writing X++ code before. Map's are part of Collection classes that exist inside Dynamics AX. Well one of the strangest things about this Collection class, is that it's lack or sorting methods. It does not have any. You can't sort a Map object by values or Keys, and if you can, it's buried so deep that no one has wrote about it or found it. What kind of sorting I did see today, with my partner in crime Derek Pate, was based on the Type for the Key value of the map. For example, say you have: 3,4,5,6,7,8,10,12,14,16 as values. Now if these values are integer based from the source your pulling from or you convert to, and you take and insert these values as listed with some form of while loopping on the object that carried these values for you, sorted in the above way, you would expect these to appear in the object your inserting too, in that same sorted order. Right? Wrong! If you are trying to insert the above values, of type integer, into a Map of Types::String, Types::String you will end up with the following sorted values for that Map's value elements: "10","12","14","16","3","4","5","6","7","8" So even though there is not a known / published sorting method or built-in function for sorting a Map, it tries to automatically sort the values for you based on type, even though you inserted those values into the map object the order desired. This is one of those strange things that exists, that should not actually. The ability to sort, and sorting to exist for the developer at hand. Not a guessed sorting order, based on type. Maybe an improvement suggestion? Have you seen this before? Do you have a sorting method you like to use for Map Object Values? Let me know here... and check back soon! "Visit the Dynamics AX Community Page today!" ============== Источник: http://dynamics-ax.blogspot.com/2008...eal-issue.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
За это сообщение автора поблагодарили: TasmanianDevil (-1). |
|
|