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")

© 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