Open topic with navigation

# LuaField Methods

This section describes the methods provided by `LuaField` objects. A `LuaField` represents a single field in a document. You can retrieve `LuaField` objects for a document using the `LuaDocument` `getField` and `getFields` methods. In its simplest form a field has just a name and a value, but it can also contain sub-fields.

If you have a `LuaField` object called `field` you can call its methods using the '`:`' operator. For example:

    field:addField(name, value)

Method | Description
--- | ---
addField | Adds a sub field with the specified name and value.
copyField | Copies the sub field to another sub field.
copyFieldNoOverwrite | Copies the sub field to another sub field but does not overwrite the destination.
countField | Returns the number of sub fields that exist with the specified name.
deleteAttribute | Deletes the attribute with the specified name.
deleteField | Deletes the sub field(s) with the specified name.
deleteFieldByPath | Deletes the sub field(s) with the specified path.
getAttributeValue | Gets the value of an attribute.
getField | Gets the sub field specified by the name.
getFieldNames | Returns the names of all sub fields of this field.
getFields | Gets all the sub fields specified by the name.
getFieldsByRegex | Gets all sub fields where the sub field name or path matches a regular expression.
getFieldValues | Returns all the values of the sub field with the specified name.
getValueByPath | Returns the value of a sub field with the specified path.
getValuesByPath | Returns all the values of the sub field with the specified path.
hasAttribute | Returns a Boolean specifying if the field has the specified attribute passed in by name.
hasField | Returns a Boolean specifying if the sub field exists or not.
insertJson | Inserts metadata from a JSON string, LuaJsonObject, or LuaJsonArray into the field.
insertXml | Inserts XML metadata into a document.
insertXmlWithoutRoot | Inserts XML metadata into a document.
name | Returns the name of the field object in a string.
renameField | Renames a sub field.
setAttributeValue | Sets the value for the specified attribute of the field.
setValue | Sets the value of the field.
value | Returns the value of the field object.

© Copyright 2019 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm