# FieldRef.Number() Method
> Version: _Available or changed with runtime version 1.0._
Gets the number of a field as an integer.
## Syntax
```al
No :=   FieldRef.Number()
```
> 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
No
Type: ../integer/integer-data-type
## Remarks
This method is like the ../record/record-fieldno-method method.
## Example
The 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.
```al
var
    MyFieldRef: FieldRef;
    LocationRecref: RecordRef;
    FieldIndex: Integer;
begin
    LocationRecref.Open(DATABASE::Location);
    FieldIndex := 0;
    repeat
      FieldIndex  := FieldIndex + 1;
      MyFieldRef := LocationRecref.FieldIndex(FieldIndex);
      Message('Field Number: %1  Field Caption: %2.' , MyFieldRef.Number, MyFieldRef.Caption);
    until FieldIndex = 10;
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-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. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/fieldref/fieldref-number-method/
