result property

Field.result property

Gets or sets text that is between the field separator and field end.

def result(self) -> str:

def result(self, value: str):


Shows how to insert a field into a document using a field code.

doc = aw.Document()
builder = aw.DocumentBuilder(doc)
field = builder.insert_field('DATE \\@ "dddd, MMMM dd, yyyy"')
self.assertEqual(aw.fields.FieldType.FIELD_DATE, field.type)
self.assertEqual('DATE \\@ "dddd, MMMM dd, yyyy"', field.get_field_code())
# This overload of the "insert_field" method automatically updates inserted fields.
self.assertAlmostEqual(datetime.strptime(field.result, '%A, %B %d, %Y'),, delta=timedelta(1))

See Also