Open topic with navigation

# getValueByPath

The `getValueByPath` method gets the value of a sub-field, specified by path. If you pass this method the path of a sub-field that has multiple values, only the first value is returned. To return all of the values from a multi-value sub-field, see getValuesByPath.

## Syntax

    getValueByPath( path )

## Arguments

Argument | Description
--- | ---
`path` | (string) The path of the sub-field.

## Returns

(String). A string containing the value.

## Example

Consider the following document:

    <DOCUMENT>
      ...
      <A_FIELD>
        <subfield>
          <anothersubfield>the value to return</anothersubfield>
        </subfield>
      </A_FIELD>
      ...
    </DOCUMENT>

The following example demonstrates how to retrieve the value "the value to return" from the sub-field `anothersubfield`, using a LuaField object representing `A_FIELD`:

    local field = document:getField("A_FIELD")
    local value = field:getValueByPath("subfield/anothersubfield")

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

_HP_HTML5_bannerTitle.htm