In this article, we will learn how we can use the temporary table as a form datasource in D365. In our scenario, we will populate the temporary table at runtime and bind it with the form datasource. firstly, we will pass an argument on the clicked event and write the form datasource init method to populate the data in it. In our scenario we will work on the CustTable form, we will populate the customer group in the temporary table which we create on the selected customer while clicking the button. Step 1: Create a new table of type TempDB and add two new fields i.e., CustGroupId and CustGroup. Step 2: We will create a new form with the pattern (List Type), then add our previously created temporary table as a datasource, and then drag both the fields CustGroupId and CustGroup on the form grid part. After the form creation, we will also create the display menu item of type form and use our form on it. Step 3: We will create an extension of t...
The RecordInsertList class facilitates array insertion functionality within the kernel. This feature enables the simultaneous insertion of multiple records into the database, thereby minimizing communication overhead between the application and the database.
When iterating through a while loop, it's optional to insert each record individually and hit the database while inserting every single iteration. An alternative and efficient approach is to utilize RecordInsertList because It will minimize the number of hits to the database. It can speed up your performance of insertion.
Here is an example of set based RecordInsertList class in which I am inserting data into my temp table:
MDTableTmp mdTableTmp;
CustTable custTable;
CustGroup custGroup;
RecordInsertList recordInsertListTmpTable;
recordInsertListTmpTable = new RecordInsertList(tableNum(MDTableTmp),
false,
false,
false,
false,
false,
mdTableTmp);
ttsbegin;
while select AccountNum, Currency, TaxGroup
from custTable
join Name
from custGroup
where custTable.CustGroup == custGroup.CustGroup
&& custGroup.CustGroup == custGroupId
{
mdTableTmp.clear();
mdTableTmp.AccountNum = custTable.AccountNum;
mdTableTmp.Currency = custTable.Currency;
mdTableTmp.TaxGroup = custTable.TaxGroup;
mdTableTmp.Name = custGroup.Name;
recordInsertListTmpTable.add(mdTableTmp);
}
recordInsertListTmpTable.insertDatabase();
ttscommit;
Comments
Post a Comment