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 with the specified name.
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.
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.
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.

© 2016 Hewlett Packard Enterprise Development LP | Send documentation feedback to HPE Close We welcome your comments! 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 AutonomyTPFeedback@hpe.com. Product: Topic Title: Help Topic: Feedback:

_HP_HTML5_bannerTitle.htm