Sorting

Hey, i’ve read through all sorting-threats, but didn’t find something solving my problem. I want to sort the records of a temporary table. Selecting a key it is no problem. But i have to sort first for field 2 and then for field 1. Unforunately the key keeps field1 before field2. Hence the sorting result is not what i want. Is there a way to make navision sort selected records in another way the key keeps the fields ? Or is the only solution to create a new key with the same fields, but in another order ? Stefan Weinreich Billing Analyst

Hello Stefan, I would probably choose to create a new key with the fields in the desired order. Hope this is of help. -------------------------------- Edward Bloomfield Navision Support Consultant Cambridge Online Systems Limited www.cambridgeonline.net

I think you can only use the first key for temporary tables (I haven’t checked Attain, so I dont know if it is still the case), so maybe defining a new key for the table will not help… There are different ways of achieving your goal though. A couple of suggestions: 1) if field1 and field2 can be swapped when you insert into the temp. table, that might do the trick. 2) checking the data types and keys of other tables, if the (first) key fulfills your sort order, you can find the real record from the key when you need the output or maybe even insert what you need into other fields with the appropriate datatypes. 3) (I have used this for systems requiring heavy statistical reports) Make a new table, which is used only temp with a long key containing different datatypes (Example Code1, Code2, Text1, Text2, Date1, Date2) and add a couple of other fields to the table for containing data for your output eg. Textfields…

Temporary tables can only use the primary key, not secondary keys. Lars Strøm Valsted ------------------------- Why can’t programmers tell the difference between Christmas and Halloween? Because OCT(31) = DEC(25)

Seems strange. I’ve used successfuly a secondary key of a temporary table and at least for me /and for the customer/ it works? It is on Attain 3.10A if that matters.

John: nice suggestions ! Swapping the data is a fine idea. Unfortunately i need a textfield and a datefield. But for further tasks it will be very helpful. Lars: i don’t agree, because the key i’m using is a secondary key. If the system would use only the primary key for the temporary table the order of the records should be not the same i got. Nikola: we’re using NF DE2.50, and there the secondary keys for temporary tables seem to work as well. Thanks so far for your help Stefan Weinreich Billing Analyst

quote:


Originally posted by lstroem: Temporary tables can only use the primary key, not secondary keys.


This limitation applies only to versions before ~2.50. Kind regards, Jan Hoek Weha Automatisering BV Woerden - The Netherlands