Find the "real" next line number

GaryDGaryD Member Posts: 66
Hello all. We've got the sales order subform showing lines that the users don't necessarily want to see, so we've added a checkbox allowing them to hide those lines. This is done using a filter. The problem with this is that when the filter is in place and we try to insert a new line we get an error saying that this Document Type/Document No./Line No. combination already exists. Seems that it is determining the next line number based upon the the filter that's in place so ends up trying to use a line number that already exists but is filtered out. Is there a way around this or should NAV even be using a filtered set of data to return the next line number?

Thanks in advance!

Comments

  • kinekine Member Posts: 12,562
    As you can see, it is not possible to just filter some lines out and still use the standard SplitKey function to number the lines. You need to add own function to find next line no. e.g. in OnNewRecord (Form) or OnInsert trigger (Table).
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • SavatageSavatage Member Posts: 7,142
    can you give an example of lines they don't want to see?
  • GaryDGaryD Member Posts: 66
    As far as examples, it's mainly just comment records at the vendor, item, or customer level. They can increase the number of detail records by quite a few and sometimes it's just easier if you can clear them from the form. We've already coded in the OnInsert trigger to do what we want, with some special handling around the AutoSplitKey. Thanks for your input!
Sign In or Register to comment.