Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV forum
Unanswered

Insert Multiple Lines record in single table

Posted on by 768

To insert a single  Line Record in a table from C/AL, AL  is done by using Insert function but to insert more then one line is little different because in this condition you need to change the primary key so the below code is the solution to insert multiple line record.

//Rec is a record variable 

IF Rec.FINDLAST THEN
Rec.PrimaryKey := Rec.PrimaryKey + 3; // This line code will find the last no and will increase by 3
Rec.name:= 'First line';
Rec.INSERT(TRUE);
Rec.FINDLAST;
Rec.PrimaryKey := Rec.PrimaryKey + 3;
Rec.name:= 'Secsond Line'; 
Rec.INSERT(TRUE);


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,532 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,501 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans