How to sort subform lines based on column

itortuitortu Member Posts: 5
edited 2014-02-10 in NAV Three Tier
I have a request to change the way that the lines are displayed on a NAV sub-form/ page.
I would like to use a specific column to assign a default order by sorting to the lines.

Is this a relatively easy to intermediate type of change? I am not very versed in writing C/AL code and working with record sets in the object designer.

Any help, recommendations, code examples would be great if you have any.

Thank you.

I want to sort by Annual Volume (desc)
Alejandro
--
Es buen ejercicio acostumbrarse a la compañia de la gente sencilla pues tanto la humildad como la soberbia se transmiten a menudo por simple contacto.

Comments

  • geordiegeordie Member Posts: 655
    Hi, it's very easy: create the key on the table (View -> Keys and specify the target field); after, on the subpage object, change the key of SourceTableView table.
  • itortuitortu Member Posts: 5
    Hi. Thank you for the reply. I did created a new key. I was told that this will only be for viewing and that the sort by should be changed to the original when adding a new line item.

    Is this correct?

    What can be affected if I change the default key on the object? Will that mess up the line enumeration?

    Thank you.
    Alejandro
    --
    Es buen ejercicio acostumbrarse a la compañia de la gente sencilla pues tanto la humildad como la soberbia se transmiten a menudo por simple contacto.
  • geordiegeordie Member Posts: 655
    Yes, secondary keys are meant for sorting and when you insert a new record the costraints of primary key are checked ("Line No." for example).
    I strongly discourage to add your "Annual Volume" field to the primary key since, as far as I see from attachment, you are working with standard sales line/purchase line and this could have a huge impact on processes.
Sign In or Register to comment.