Sorting on Var Value in List Page

DanielFDanielF Posts: 17Member
Hello eyeryone,

following issue:

I added a Field to a Table. The Value is calculated by OnAfterGetRecord-Trigger in List Page. Now when sorting on the Coloumn of this Field in List Navision shows a different amount of Records in the List Page.

Example:
Navision 2015 Demo Database.
Table Vendor extended by Integer Variable.
Function in Table Vendor to assign Value to Variable.

Function gets Called in OnAfterGetRecord-Trigger on Vendor List Page.

myvdm9px40wh.png

linz0xl09k1d.png

Can I fix this?

Work around disabling sorting on whole List is possible - is this possible only for Variable Coloumn?


Kind Regards
Daniel

Comments

  • Slawek_GuzekSlawek_Guzek Posts: 1,638Member
    Hi,

    There was no need to add an extra field in Vendor table. All you need is a global variable on the Page, this variable needs to be used in SourceExp in the column, and its value needs to be calculated in OnAfterGetRecord - that's it. NAV will not let you to sort using that column.

    Slawek
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • DanielFDanielF Posts: 17Member
    Hi Slawek_Guzek,

    thanks for your reply. Yes I was wrong - I changed to Var on Page.

    Kind Regards
  • otrootro Posts: 1Member
    edited 2019-02-07
    Hi,

    There was no need to add an extra field in Vendor table. All you need is a global variable on the Page, this variable needs to be used in SourceExp in the column, and its value needs to be calculated in OnAfterGetRecord - that's it. NAV will not let you to sort using that column.

    Slawek

    Sorting/Filtering in List page is not available on control which source expression is variable/function.
    Only sorting of field controls available. At least in NAV2016.
  • RockWithNAVRockWithNAV Posts: 786Member
    I also faced this Sorting on Variables but eventually NAV doesn't allow to do for Variables until its a part of Table.
  • Mark_SmartMark_Smart Posts: 16Member
    Is the calculation something you could do as a flowfield? That way you could have dynamic sorting.
Sign In or Register to comment.