# DataTransfer.AddSourceFilter(Integer, Text [, Any,...]) Method
> Version: _Available or changed with runtime version 10.0._
Adds a filter for the source table for the data transfer.
## Syntax
```al
 DataTransfer.AddSourceFilter(SourceField: Integer, String: Text [, Value: Any,...])
```
## Parameters
DataTransfer
Type: datatransfer-data-type
An instance of the datatransfer-data-type data type.
SourceField
Type: ../integer/integer-data-type
The field in the source table to filter on.
String
Type: ../text/text-data-type
The filter expression. A valid expression consists of alphanumeric characters and one or more of the following operators: \<, \>, \\, &, |, and =. You can use replacement fields (%1, %2, and so on) to insert values at runtime.
*[Optional] Value*
Type: ../any/any-data-type
Replacement values to insert in replacement fields in the filter expression. The data type of Value must match the data type of 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 when copy data in rows or fields from one table to another table. See Transferring Data Bewteen Tables<../../devenv-data-transfer>.
## Example
In this code example, you copy the PK and S3 fields in the Source table for all rows where S2 equals A and add them as new rows in the Destination table. You use AddConstantValue method to give the field D2 the value X in the inserted rows.
```al
local procedure CopyRows()
var
    dt: DataTransfer;
    src: Record Source;
    dest : Record Destination;
begin
    dt.SetTables(Database::Source, Database::Destination);
    dt.AddFieldValue(src.FieldNo("PK"), dest.FieldNo("PK"));
    dt.AddFieldValue(src.FieldNo("S3"), dest.FieldNo("D3"));
    dt.AddConstantValue('X', dest.FieldNo(D2));
    dt.AddSourceFilter(src.FieldNo("S2"), '=%1', 'A');
    dt.CopyRows();
end;
```
## Related information
datatransfer-data-type
Getting Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/datatransfer/datatransfer-addsourcefilter-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/datatransfer/datatransfer-addsourcefilter-method/
