Drupal Connector 24.3

# 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 2024 Open Text
Version 24.3 | Last updated June 2024

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: IDOL Drupal Connector 24.3

Topic Title: getValueByPath