DataTransfer.AddJoin(Integer, Integer) Method
Version: Available or changed with runtime version 10.0.
Adds a field pair to be used to create a join condition which determines which rows to transfer, optional for same table transfers.
Syntax
DataTransfer.AddJoin(SourceField: Integer, DestinationField: Integer)
Parameters
DataTransfer
Type: DataTransfer
An instance of the DataTransfer data type.
SourceField
Type: Integer
The source table field.
DestinationField
Type: Integer
The destination table field.
Remarks
The DataTransfer object can only be used in upgrade code and it will throw an runtime error if used outside of upgrade codeunits.
Use this method to create a join condition between tables when copying fields from one table to the other. For more information, see Transferring Data Bewteen Tables.
This method isn't needed when copying withing the same table.
Example
In this example, you have two tables, Source and Destination. You're planning on obsoleting field S3 in the Source table. But before you do, you want to copy some values of S3 into the field D3 of the Destination table. Specifically, you only want to copy field S3 in rows where field S2 is equal to A.
local procedure CopyFields()
var
dt: DataTransfer;
dest: Record Destination;
src: Record Source;
begin
dt.SetTables(Database::Source, Database::Destination);
dt.AddFieldValue(src.FieldNo("S3"), dest.FieldNo("D3"));
dt.AddSourceFilter(src.FieldNo("S2"), '=%1', 'A');
dt.AddJoin(src.FieldNo("PK"), dest.FieldNo("PK"));
dt.CopyFields();
end;
See Also
DataTransfer Data Type
Getting Started with AL
Developing Extensions
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈