You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DataTransfer is an AL data type that supports the bulk transferring of data between SQL based tables. Instead of operating on a row-by-row model, like the record API does, DataTransfer produces SQL code that operates on sets. This behavior improves the performance when moving data during upgrade and install.
codeunit50100 MyCodeunit
{
Subtype = Upgrade;
trigger OnUpgradePerCompany()var
OldTable: Record OldTable;
NewTable: Record NewTable;
TableDataTransfer: DataTransfer;
begin
TableDataTransfer.SetTables(Database::OldTable, Database::NewTable);
TableDataTransfer.AddJoin(OldTable.FieldNo(Code), NewTable.FieldNo(Code));
TableDataTransfer.AddFieldValue(OldTable.FieldNo(Code), NewTable.FieldNo(Code));
TableDataTransfer.AddFieldValue(OldTable.FieldNo(Description), NewTable.FieldNo(Description));
TableDataTransfer.CopyRows();
Clear(TableDataTransfer);
end;
}
So when a codeunit has the property Subtype = Install; or Subtype = Upgrade; then raise a diagnostic when a .TransferFields method is declared.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The DataTransfer provides more control and possibilities then TransferFields.
So when a codeunit has the property
Subtype = Install;
orSubtype = Upgrade;
then raise a diagnostic when a.TransferFields
method is declared.Beta Was this translation helpful? Give feedback.
All reactions