Notifications
Announcements
No record found.
Hi,
Let's say PriceDiscTable has 10 records when i filter by a certain field
I want to create a new customer and if this customer has the same certain field then i need to insert those 10 records in priceDiscTable for that new customer.. Same data just the account relation is different
Hi junior AX,
I'm not sure if I understand the question.
Are you asking how to insert 10 records with one database operation - and provide some fixed value for some field for all those records?
Or, are you asking how to do this with insert_recordset?
Regarding insert_recordset, it always copies data from one table to another, as you can find in the docs page: https://docs.microsoft.com/en-us/dynamicsax-2012/developer/insert-recordset . So if your question is about how to achieve your requirement with insert_recordset, I think it's not possible.
Ah, or do you mean that you would like to use insert_recordset to copy all fields, and not having to specify each field separately? That's also not possible, as you will see in the documentation.
Hi Nikolaos,
I want to insert the same data for those 10 records except that the accountRelation will be different
What is the best way to do it.. And why insert record won't work
insert_recordset works, but you have to mention each column that you want to copy.
If you don't want to do that, you can do something like this:
MyTable myTable1, myTable2; while select myTable1 { myTable2.clear(); myTable2.data(myTable1); myTable2.SomeField = 'foo'; myTable2.insert(); }
And if you want to insert all records in one database call, you can use recordInsertList.
Hi Nikolas,
Which one is better for perfomance, insertRecordSet or insert recordList or the while loop
Hi juniorAX,
insertRecordSet and RecordInsertList can be used to insert many records in one database call.
If you make many inserts in a while loop, you'll do one database call for each insert.
It's faster to make one database call than many calls. But it doesn't really matter in your scenario since you're just inserting 10 records when you create a new customer.
Hi Nokolas,
It might be more than 10 records. 10 records was an example.
So it might be 300 records
Does insert_recordset use one database call?
Also i noticed that recordInsertList uses a while loop
So now which one is the best approach
Here's my logic.. Not sure if it's correct
Hi, you can use either one, if both suit your requirements. Your code is missing some details from my example, but you can choose whether to follow the example or not. Regarding your other questions, you can look in the product documentation.
The while loop condistion in the picture above is wrong. It's priceDiscTableLocal. AccountRelation ==priceDiscTable. AccountRelation
Your original requirement can be solved with Query::insert_recordset().
Both insert_recordset and Query::insert_recordset() uses a single database call, unless it's forced to use row-by-row processing. See Maintain Fast SQL Operations, for example.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Abhilash Warrier 669 Super User 2025 Season 2
André Arnaud de Cal... 449 Super User 2025 Season 2
Martin Dráb 384 Most Valuable Professional