---
url: /flow/guide/scripting-reference/referencing-fields.md
---

# Referencing Fields

The bulk of your scripts will involve referencing fields - that is using the value of a field. You will need to set the value of a destination field to the value of a source field.

A field is referenced through the [Data Set](/flow/guide/scripting-reference/classes/data-set/) object. A data set object contains an array of fields which you can reference by providing their name

For example if you have a data set called `INVOICE_HEADER` will contains a field called `INVOICENO` you would reference this field using `INVOICE_HEADER['INVOICENO']`

Having accessed the field object you can get or set its value using one of the following properties. These different access methods handle null values differently. .Value will return a null, whereas the others will convert a null into a blank string or zero.

::: details Accessing the value of a field with `.Value`
.Value is used to get or set the value of the field as a [Variant (Variant)](/flow/guide/scripting-reference/data-types/variant). A field with null value will be returned as null.

When used on the left hand side of an assignment operator it will set the value eg `INVOICE_HEADER['INVOICENO'].Value := 10012;`. When used on the right hand side of an assignment operator it will get the value eg `Value := INVOICE_HEADER['INVOICENO'].Value;`
:::

::: details Accessing the value of a field with `.AsString`
.AsString is used to get or set the value of the field as a [String (String, Widestring)](/flow/guide/scripting-reference/data-types/string). This can be used with fields of any data type. A field with null value will be returned as a blank string eg ''

When used on the left hand side of an assignment operator it will set the value eg `INVOICE_HEADER['INVOICENO'].AsString:='10012';`. When used on the right hand side of an assignment operator it will get the value eg `Value := INVOICE_HEADER['INVOICENO'].AsString;`
:::

::: details Accessing the value of a field with `.AsInteger`
.AsInteger is used to get or set the value of the field as an [Integer (Integer, Cardinal, Int64)](/flow/guide/scripting-reference/data-types/integer). This should only be used with fields of Integer data type. A field with null value will be returned as zero.

When used on the left hand side of an assignment operator it will set the value eg `INVOICE_HEADER['CUSTNO'].AsInteger:= 10012;`. When used on the right hand side of an assignment operator it will get the value eg `Value := INVOICE_HEADER['CUSTNO'].AsInteger;`
:::

::: details Accessing the value of a field with `.AsFloat`
.AsFloat is used to get or set the value of the field as a [Float (Double, Extended, Currency)](/flow/guide/scripting-reference/data-types/float). This should only be used with fields of Float data type. A field with null value will be returned as zero.

When used on the left hand side of an assignment operator it will set the value eg `INVOICE_HEADER['SUBTOTAL'].AsFloat:= 123.45;`. When used on the right hand side of an assignment operator it will get the value eg `Value := INVOICE_HEADER['SUBTOTAL'].AsFloat;`
:::

Refer to the [Field](/flow/guide/scripting-reference/classes/field/) class for more information on the properties of the field class
