{"title":"FieldRef.Number() Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/fieldref/fieldref-number-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-number-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-number-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 number of a field as an integer.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Syntax","slug":"syntax","at":102,"chars":112},{"level":2,"title":"Parameters","slug":"parameters","at":214,"chars":97},{"level":2,"title":"Return Value","slug":"return-value","at":311,"chars":54},{"level":2,"title":"Remarks","slug":"remarks","at":365,"chars":75},{"level":2,"title":"Example","slug":"example","at":440,"chars":1145},{"level":2,"title":"Related information","slug":"related-information","at":1585,"chars":136}],"text":"> Version: _Available or changed with runtime version 1.0._\nGets the number of a field as an integer.\n## Syntax\n```al\nNo :=   FieldRef.Number()\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\nNo\nType: ../integer/integer-data-type\n## Remarks\nThis method is like the ../record/record-fieldno-method method.\n## Example\nThe following example displays the caption and the field number of the first 10 fields in the Location table. The Location table is open as a ../recordref/recordref-data-type object and the reference is stored in the LocationRecref variable. The FieldIndex variable that stores the field index is initialized to 0. The LocationRecref variable uses the ../recordref/recordref-fieldindex-method to create a FieldRef that is named MyFieldRef for the specified field index. MyFiledRef now references the field that is specified by the FieldIndex. MyFieldref is then used to display the number and caption of the field The fieldref-number-method method retrieves the field number. This is repeated for the first ten fields in the table.\n```al\nvar\n    MyFieldRef: FieldRef;\n    LocationRecref: RecordRef;\n    FieldIndex: Integer;\nbegin\n    LocationRecref.Open(DATABASE::Location);\n    FieldIndex := 0;\n    repeat\n      FieldIndex  := FieldIndex + 1;\n      MyFieldRef := LocationRecref.FieldIndex(FieldIndex);\n      Message('Field Number: %1  Field Caption: %2.' , MyFieldRef.Number, MyFieldRef.Caption);\n    until FieldIndex = 10;\nend;\n```\n## Related information\nfieldref-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}