Line No from Purchase Order line

tompynationtompynation Member Posts: 398
Where can i find the code which creates the Line No. for the Purchase Order?

I need to adapt this...

Answers

  • SavatageSavatage Member Posts: 7,142
    You're looking for the autosplitkey - search form for that or use c/side reference guide

    viewtopic.php?t=20168
    viewtopic.php?f=23&t=25952

    I don't think you can alter that but you could remove/disable it but you'll have to comeup with you're own code to create line no's then.
  • tompynationtompynation Member Posts: 398
    well, i see the auto split key property... But where does it now say that it should add 10000 for each new Line No.

    Or when i just put this autosplit key to No, would the only thing to be done then is adding some code
    to the OnInsert trigger of the Purchase Line table to fill up the Line No.? Or is this much more complex then how i see it?
  • kapamaroukapamarou Member Posts: 1,152
    I think you can't change the 10000. It's there to allow you to add a number of new lines in between existing lines...
  • SavatageSavatage Member Posts: 7,142
    Or when i just put this autosplit key to No, would the only thing to be done then is adding some code
    to the OnInsert trigger of the Purchase Line table to fill up the Line No.?

    I think yes, How or why did you need to Alter this?
  • tompynationtompynation Member Posts: 398
    well, i have added a new type to the Purchase Lines, namely 'Set'

    When you enter a set, there are some purchase line that get automatically created...
    SO when you add the Set 'MTBKGR' with line no 20000

    There are automatically 2 new Purch Lines created, with Line No's: 20100 & 20200...
    So they are under the 20000 so you now that these belong to the Set line 20000

    When you now add a new Item purchase Line then his Line No. is 30200. Which i dont want. Cause that looks like its an item which is Under a the Set Line 30000, but this isnt the case... Its a normal entered line.
  • tompynationtompynation Member Posts: 398
    Its working now like it should by disabling the AutoSplitKey property and adding the Following code to the OnInsertTrigger

    lv_PurchLine.RESET;
    lv_PurchLine.SETRANGE("Document No.","Document No.");
    IF lv_PurchLine.FIND('+') THEN
    "Line No." := ROUND(lv_PurchLine."Line No.",1000,'=') + 10000
    ELSE
    "Line No." := 10000;
  • kapamaroukapamarou Member Posts: 1,152
    Actually the line no is not something "used" by the user. What I would do would be to let Nav give the line no it wants and create an extra field that when the line belongs to a set, it contains the set's line number. This way you can distinguish the lines belonging to the same set regardless the line's appearance.
Sign In or Register to comment.