Sorting on a non key field for a Report


I’ve done some searches on how to solve this issue, and I have come across a couple of solutions. I have seen the suggestion of making new table that has field I’m trying to sort on as a key. And the other suggestion I’ve seen is to create an array and just write the code to sort that array.

I am fairly novice still with Navision (been learning it over the last month and a half, or so) … and I can’t figure out how to really start down either path. Which one would be the simpler, most efficient way to tackle this?

I was originally thinking the Array/Sort method, but I can’t figure out A.) what data type would I make the array variable? B.) Once I have the array set up, how do I use it to output the records in the order I’m looking for? And what Trigger would the sorting code go into?

If creating a table with the needed sort field as a key is more efficient … how would I go about making that table?

Any help would be appreciated!


And if it helps … we are on Navision 3.7 (old school, I know. We’re about to move to 6 or 7 here pretty soon) … and using a Native Database.

You can add a key…

Of course, as every key must be maintained, this adds load to db engine (on which you are - Native or MSSQL?)

It really depends on the report. Most importantly the ratio of the total number of records in the table to the number actually being printed and sorted in the report.

As to an array, I would not even consider that path. A temp table yes, but not an array.

The total number of records is in the 56k range … where the number printed is usually around 100.

I’ve never used a temp table before. Could you, or anyone else, point me in the direction of a place where I can learn to do that. Or if it is straight-forward enough, could you explain it here?

Thanks, again!

Guess I should have done a quick search before asking that. I found a few pages that explain temp tables.

I ended up just adding the field to the table, and keying it on that.