Options

Filling the AutoSplitKey when inserting records through Code

harm.poelenharm.poelen Member Posts: 36
Hi There,

I'm trying to insert records in the Navision Item Journal through code. All works well except that the Line No. Field is a AutoSplitKey field that is handled by the Form... and I am not using the Form.

I am about to write some code in the OnInsert trigger of the Item Journal Line table too lookup the last Line No. in the table and then add 100000... but I can not believe that that is the way to do this... or is it?

Harm

PS: HAPPY NEW YEAR TO ANYONE READING THIS MESSAGE !
CANE Microsoft Solutions BV
Prins Hendrikplein 14
2518 JC DEN HAAG
The Netherlands
http://www.cane.nl

Comments

  • Options
    Dean_AxonDean_Axon Member Posts: 193
    Hi Harm,

    Afraid the answer is yes #-o.

    I have never found any other way to do it but then I do not confess to know all there is to know about C/AL coding.
    Remember: Keep it simple
  • Options
    ara3nara3n Member Posts: 9,256
    Have you looked at xRec. and see what the value of Line No is?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    eromeineromein Member Posts: 589
    Well...

    Maybe the OnInsert isn't the best place......

    If you fill the table from only one point in Navision it's maybe better to fill the line no. from there.

    If this isn't possible... Then you have to do it like you are doing it.
    "Real programmers don't comment their code.
    If it was hard to write, it should be hard to understand."
  • Options
    Dmitry_ChadaevDmitry_Chadaev Member Posts: 52
    Hi Harm,

    Take a look on Form 5198 Attendee Wizard Subform.
    They implemented AutoSplitKey in C/AL there :)

    Have fun!
    Best regards,
    Dmitry
Sign In or Register to comment.