web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Insert Multiple Lines record in single table

(0) ShareShare
ReportReport
Posted on by 782

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);


*This post is locked for comments

I have the same question (0)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
Alexander Ermakov Profile Picture

Alexander Ermakov 2

#2
SC666 Profile Picture

SC666 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans