xref:lookupXRef

Syntax

xref:lookupXRef (mapName, referenceElementName, xrefReferenceValue, elementName, needAnException)

Description

Use the lookupXRef function to look up a cross-reference element for a value that corresponds to a specific value in a reference element.

Parameters

Parameter Description

mapName

The name of the cross-reference map, as string.

referenceElementName

The name of the reference element, as string.

referenceValue

The value corresponding to the reference element name, as string.

elementName

The name of the element to be looked up for the value, as string.

needAnException

Specify true or false.

If the needAnException parameter is set to true, an exception occurs if the value being looked up in the map is not found. If the needAnException parameter is set to false, an empty value is returned if the value being looked up in the map is not found.

Returns

The value of the requested element.

An exception can occur for the following reasons:

  • The cross-reference map with the given name is not found.

  • The specified element names are not found.

  • The specified reference value is empty.

  • Multiple target values are found.

Example

The following code looks up the Common element of the customers cross-reference map for a value corresponding to the PS001 value in the PS element:

xref:lookupXRef("customers","PS","PS001","Common",true())