Multiple Sorting On Form

happydayshappydays Member Posts: 7
Even though I have been using this site for years this is my first post so please be gently with me.

I am trying to find out if there is a way of sorting a form view by two fields. The first field in descending order and the second field by accending order. Is this possible.

The form that I am trying to sort is the Rlshp. Mgt. Comment Line table. My Key is Date, Comment. Therefore I want to show the newest entry first (Date - descending) but then show the comment in acending order.

If I use standard decending within the key I get

01/08/08 Line 4
01/08/08 Line 3
01/08/08 Line 2
01/08/08 Line 1

but would like to get

01/08/08 Line 1
01/08/08 Line 2
01/08/08 Line 3
01/08/08 Line 4

any guidance on this would be gratefully received.

](*,)
Some things are just there to keep you mentally active.

Comments

  • McClaneMcClane Member Posts: 40
    You could copy the Data to a TempTable, but multiply the line No. by (-1) and then show your form based on this tempTable.
  • kinekine Member Posts: 12,562
    you can go around the ascending&descending order problem by adding new field which will keep negative value of the line number. Than you can sort it ascending in both fields and you are done....

    Date Line No. Line No. (Neg)
    01/08/08 4 -4
    01/08/08 3 -3
    01/08/08 2 -2
    01/08/08 1 -1

    Sorting order: Date,Line No.(Neg)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • happydayshappydays Member Posts: 7
    kine wrote:
    you can go around the ascending&descending order problem by adding new field which will keep negative value of the line number. Than you can sort it ascending in both fields and you are done....

    Date Line No. Line No. (Neg)
    01/08/08 4 -4
    01/08/08 3 -3
    01/08/08 2 -2
    01/08/08 1 -1

    Sorting order: Date,Line No.(Neg)

    At what point would you update the negative line value.
    Would this be on the insert of the new line.
    Some things are just there to keep you mentally active.
  • kinekine Member Posts: 12,562
    Yes, for example... (if the line no. is filled though AutoSplitKey functionality).
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • happydayshappydays Member Posts: 7
    kine wrote:
    Yes, for example... (if the line no. is filled though AutoSplitKey functionality).

    I have place this on the modify and insert values within the Table. It seems to work so I would like to thank you for your help.

    Please can you let me know if what I have done does not make sense.

    \:D/
    =D>
    Some things are just there to keep you mentally active.
  • happydayshappydays Member Posts: 7
    kine wrote:
    Yes, for example... (if the line no. is filled though AutoSplitKey functionality).

    Hi Kine

    Sorry about this but when I try to create a new line it says that the line no already exists and if I try to place a new line underneath the las number it tells me that the autosplit key message.

    Can anyone help.
    Some things are just there to keep you mentally active.
  • kinekine Member Posts: 12,562
    of course, if you sort the table by another key than primary key, the autosplitkey functionality is not working correctly... but it has no meaning to insert lines when sorting in different order than line no.

    Please, if you have problem with inserting the line through code, post the code. But now it seems for me like combination of more things. Keep it simple. Have you solved the problem of sorting the form? You can sort it, but in this case, you cannot enter into it new lines...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • happydayshappydays Member Posts: 7
    kine wrote:
    of course, if you sort the table by another key than primary key, the autosplitkey functionality is not working correctly... but it has no meaning to insert lines when sorting in different order than line no.

    Please, if you have problem with inserting the line through code, post the code. But now it seems for me like combination of more things. Keep it simple. Have you solved the problem of sorting the form? You can sort it, but in this case, you cannot enter into it new lines...

    Hi Kine

    Many thanks to your response. I have sorted out the issue with sorting the form and as long as they reset the sorting they can now add lines. This task is more difficult as I am also using the Waldo Notepad to insert into the comment lines as well. So I think it is best not to make it any more changes.

    Many thanks for your help hopefully I will be able to return the help I have received now I have become a member.

    Regards

    :D
    Some things are just there to keep you mentally active.
Sign In or Register to comment.