Set Line No in table

jorgitojorgito Member Posts: 115
Hi all.

I have created 2 new tables Header and Line.
In the Line table I have added a Header No. field that links the Line records to the Header records. I have added a Line No. field in the Line table.

How do I set the Line No in the Line table to get numbers 10000, 20000 etc.

I tried looking at the Sales Header and Sales Line tables to get some idea but I can't find the part that Line No is initialized.

Any ideas?

Thanks
Jorgito

Answers

  • DenSterDenSter Member Posts: 8,307
    The last primary key field of your line must be an integer type field (call it 'Line No.' like in std Navision). Then on the subform, where you put the lines, you set the AutoSplitKey property to Yes, and Navision will take care of the line number automatically. Magic :mrgreen:
  • RiteshKSRiteshKS Member Posts: 21
    Set Line No. field's property "Auto Increment" to yes. :wink:
    should solve your purpose
    Regards

    R.K.S
    Consultant ERP
  • DenSterDenSter Member Posts: 8,307
    No that is not the way it works. Auto-increment is not the way that the sales line number is incremented. Use the AutoSplitKey feature of the line form.
  • jorgitojorgito Member Posts: 115
    I noticed that the AutoSplitKey creates the next Line No., but also the DelayedInsert does not insert the new line until values have been entered.

    Thanx everyone
    Jorgito
  • jorgitojorgito Member Posts: 115
    Another relative question.

    In the Prod. Order Line table (5406), I am trying to insert the Prod. Order Components automatically when the user selects the Item No. However, when I am inserting a new record, the Line No. of the Prod. Order Line table is still 0. So I cannot insert new lines in the Prod. Order Component table. How should I overcome this problem?

    Thanx,
    Jorgito
  • ShenpenShenpen Member Posts: 386
    Not an elegant solution, but the on the form OnAfterValidate trigger for Item No. should do the trick. However, it would be nicer to do it in the table. Are you sure Item No. - OnValidate does not work in the table?

    Do It Yourself is they key. Standard code might work - your code surely works.
  • jorgitojorgito Member Posts: 115
    Thanx a lot, BlackTiger. This solved my problem!!
Sign In or Register to comment.