{"title":"FieldRef.GetFilter() Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/fieldref/fieldref-getfilter-method/","by":"JOP-AL","license":"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.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/fieldref/fieldref-getfilter-method","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Gets the filter that is currently applied to the field referred to by FieldRef.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Syntax","slug":"syntax","at":140,"chars":119},{"level":2,"title":"Parameters","slug":"parameters","at":259,"chars":97},{"level":2,"title":"Return Value","slug":"return-value","at":356,"chars":52},{"level":2,"title":"Remarks","slug":"remarks","at":408,"chars":178},{"level":2,"title":"Example","slug":"example","at":586,"chars":1323},{"level":2,"title":"Related information","slug":"related-information","at":1909,"chars":136}],"text":"> Version: _Available or changed with runtime version 1.0._\nGets the filter that is currently applied to the field referred to by FieldRef.\n## Syntax\n```al\nString :=   FieldRef.GetFilter()\n```\n> NOTE\n> This method can be invoked using property access syntax.\n## Parameters\nFieldRef\nType: fieldref-data-type\nAn instance of the fieldref-data-type data type.\n## Return Value\nString\nType: ../text/text-data-type\n## Remarks\nSee also ../recordref/recordref-getfilters-method, fieldref-setfilter-method, and fieldref-setrange-method.\nThis method is like the ../record/record-getfilter-method.\n## Example\nThe 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.\n```al\nvar\n    MyFieldRef: FieldRef;\n    CustomerRecref: RecordRef;\n    Filters1: Text;\n    Filters2: Text;\n    Text000: Label 'Filter before filters set: %1.';\n    Text001: Label 'Filter after filters set: %1.';\nbegin\n    CustomerRecref.Open(Database::Customer);\n    MyFieldRef := CustomerRecref.Field(1);\n    Filters1 := MyFieldRef.GetFilter;\n    Message(Text000, Filters1);\n    MyFieldRef.SetFilter('10000..40000');\n    Filters2 := MyFieldRef.GetFilter;\n    Message(Text001, Filters2);\nend;\n\n```\n## Related information\nfieldref-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}