# FieldRef.GetFilter() Method
> Version: _Available or changed with runtime version 1.0._
Gets the filter that is currently applied to the field referred to by FieldRef.
## Syntax
```al
String :=   FieldRef.GetFilter()
```
> NOTE
> This method can be invoked using property access syntax.
## Parameters
FieldRef
Type: fieldref-data-type
An instance of the fieldref-data-type data type.
## Return Value
String
Type: ../text/text-data-type
## Remarks
See also ../recordref/recordref-getfilters-method, fieldref-setfilter-method, and fieldref-setrange-method.
This method is like the ../record/record-getfilter-method.
## Example
The following example opens the Customer table as a RecordRef variable that is named CustomerRecref. The ../recordref/recordref-field-method creates a FieldRef for the first field \(No.\) and stores the reference in the MyFieldRef variable. The GetFilter method retrieves the filters that are set on the No. field and stores the value in the Filters1 variable. The value of any filter that is set is displayed in a message box. The fieldref-setfilter-method sets the filter that selects records from 10000 to 40000 in the No. field. The GetFilter method retrieves and stores the filter in the Filter2 variable and displays it in a message. The value in the Filter1 variable is blank because no filter is set. The value in Filter2 is 10000..40000 because of the filter that is set by the fieldref-setfilter-method.
```al
var
    MyFieldRef: FieldRef;
    CustomerRecref: RecordRef;
    Filters1: Text;
    Filters2: Text;
    Text000: Label 'Filter before filters set: %1.';
    Text001: Label 'Filter after filters set: %1.';
begin
    CustomerRecref.Open(Database::Customer);
    MyFieldRef := CustomerRecref.Field(1);
    Filters1 := MyFieldRef.GetFilter;
    Message(Text000, Filters1);
    MyFieldRef.SetFilter('10000..40000');
    Filters2 := MyFieldRef.GetFilter;
    Message(Text001, Filters2);
end;

```
## Related information
fieldref-data-type
Get 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/fieldref/fieldref-getfilter-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/fieldref/fieldref-getfilter-method/
