Defining Keys to tables

I have a table with fields A and B. I need to sort the records in the table by ascending order of A and descending order of B. I do not see a way of defining the order when creating a key. I can see that there is a command ASCENDING which lets us specify the order for the entire key. My key is basically A+B. I need A to be in ascending order and B in descending order within the key. Can we define two keys separately for A and B and then combine the keys for record selection? Is there a way of doing this using SETCURRENTKEY? Pari Somasundaram.

In report you can make this: !!! Field A must be based on another table with unique values (“Header Table A”) make report: Level 1:“Header Table A” (sorted by “Field A” in asc. order) Level 2: “Table AB” (sorted by “Field B” in desc. order and linked via “Field A”) But in forms… I think it’s impossible. Business Applications Programmer Sertified Navision Developer SIA “Sintegra” Latvia

quote:


Originally posted by AlexeyPavlov: In report you can make this: !!! Field A must be based on another table with unique values (“Header Table A”) make report: Level 1:“Header Table A” (sorted by “Field A” in asc. order) Level 2: “Table AB” (sorted by “Field B” in desc. order and linked via “Field A”) But in forms… I think it’s impossible. Business Applications Programmer Sertified Navision Developer SIA “Sintegra” Latvia


I apologise for not being specific. I want this sorting to be done for a form. Pari Somasundaram.

What field types are A and B? Chris Krantz NCSD,NCSQL,MCSD,MCSE Microforum Inc. Toronto, Ontario, Canada

quote:


Originally posted by chrisk: What field types are A and B? Chris Krantz NCSD,NCSQL,MCSD,MCSE Microforum Inc. Toronto, Ontario, Canada


Field A is Code of length 10 Field B is decimal. Pari Somasundaram

The easiest cheat (note cheat) would be: - Create a third field C. - On the Validate for B, put C := -B; - Create the key A,C It isn’t pretty, but I think it will work. Chris Krantz NCSD,NCSQL,MCSD,MCSE Microforum Inc. Toronto, Ontario, Canada

quote:


Originally posted by chrisk: The easiest cheat (note cheat) would be: - Create a third field C. - On the Validate for B, put C := -B; - Create the key A,C It isn’t pretty, but I think it will work. Chris Krantz NCSD,NCSQL,MCSD,MCSE Microforum Inc. Toronto, Ontario, Canada


Thanks, Chris. That was smart thinking. It works! Pari Somasundaram.

For numeric values it works perfectly… but… have u ever tried with texts or codes?? for those you can make an ordering function and use a form based on integer class for showing the records after ordering them… Regards, Alfonso Pertierra (Spain)apertierra@teleline.es

Hi, What is the use of sorting A in ascending and B in Descending. If A and B form one record it is sensible to sort either using A or using B. I cannot see a situation where you have to use such type of sorting. (Correct me if I am wrong) Thanks, Best regards, Prashanth pbg@navilogic.com

quote:


Originally posted by prashycool: Hi, What is the use of sorting A in ascending and B in Descending. If A and B form one record it is sensible to sort either using A or using B. I cannot see a situation where you have to use such type of sorting. (Correct me if I am wrong) Thanks, Best regards, Prashanth pbg@navilogic.com


We have two fields in the table Item, Material Type and Cut Length. The user would like to see a form to display items in ascending order(default) of Material Type and descending order of Cut Length. They would like to know what would be the biggest piece to be cut from the raw material. I hope this explains. Regards, Pari Somasundaram

This is of course much about tricks. 1) Redefine your material type field to get them in the order you need. 2) Add a field, maybe just in the form, defined as 9999999 - cut length, and it will all come out, ascending, the way you want. Pelle

Take a look at Just-In-Time sorting mechanism, you can find a sample on Hermida - Navisioner.com site. Alex