Domain Value Map Functions
This section describes the domain value map functions.
Syntax
dvm:lookupValue(mapName, referenceElementName, referenceValue, elementName, defaultValue, needAnException)
Description
The dvm:lookupValue function finds the reference element value in a domain value map and returns the equivalent value of the specified element name as a string. This form of DVM lookup is used to find a single reference element and return a single element value. Lookups involving multiple elements in a reference or return domain need to be done using the dvm:lookupValueNVP function.
Parameters
Parameter |
Description |
---|---|
mapName |
The domain value map name, as string. |
referenceElementName |
The source element name, as string. |
referenceValue |
The source value (an XPath expression bound to the source document of the XSLT transformation), as string. |
elementName |
The target element name, as string. |
defaultValue |
If the value is not found, then the default value is returned, 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 dvm:lookupValue returns a string containing the value of the element.
An exception can occur for the following reasons:
The DVM map with the given name is not found.
The specified elements are not found.
The specified source value is empty.
Example
The following code looks up the value of the Short element in the StateCodes DVM map corresponding to the California value in the Long element:
dvm:lookupValue("StateCodes","Long","California","Short","CouldNotBeFound",True)
Syntax
dvm:lookupValueNVP(mapName, referenceDomain, referenceNVP, targetDomain, defaultNVP, needAnException)
Description
The dvm:lookupValueNVP function finds the reference domain element values in a DVM and returns the equivalent values of all elements in the specified domain as an NVP list. This form of DVM lookup should be used when multiple elements exist in either the reference or return domain. All required elements in the reference domain must be included in the reference NVP list, but optional elements (qualifiers perhaps) do not have to be included. The return string will include values for all elements in the target domain as an NVP list regardless of whether they are required.
Parameters
Parameter |
Description |
---|---|
mapName |
The domain value map name, as string. |
referenceDomain |
The source domain name, as string. |
referenceNVP |
NVP list of source elements and values, as string. |
targetDomain |
The target domain name, as string. |
defaultNVP |
If the value is not found, then the default values specified are returned, as string. |
needAnException |
Specify true or false. |
Returns
The return string will include values for all elements in the target domain as an NVP list regardless of whether they are required.
An exception can occur for one of the following reasons:
The DVM map with the given name is not found.
The specified domains are not found.
The specified elements are not found.
The specified source values are empty.
Example
The following code looks up the specified values of the BusinessUnit and Chartfield elements in the PeopleSoft domain of the ChartElements DVM and returns the value of the UniqueGUID element:
dvm:lookupValueNVP("ChartElements","PeopleSoft","<BusinessUnit>US100</BusinessUnit><Chartfield>ACCOUNT</Chartfield>","UniqueGUID","<UniqueGUID>CouldNotBeFound</UniqueGUID>",True)
Syntax
dvm:lookup-dvm (mapName, referenceElementName, referenceValue, elementName, defaultValue, needAnException)
Description
The dvm:lookup-dvm function finds the reference element value in a domain value map and returns the equivalent value of the specified element name as a string. This form of DVM lookup is used to find a single reference element and return a single element value. Lookups involving multiple elements in a reference or return domain need to be done using the dvm:lookupValueNVP function. This function is identical in purpose and function to the dvm:lookupValue function. It exists to mimic the function names defined in the ESB implementation of DVM.
Parameters
Parameter |
Description |
---|---|
mapName |
The domain value map name, as string. |
referenceElementName |
The name of the source element in the DVM, as string. |
referenceValue |
The source value (an XPath expression bound to the source document of the XSLT transformation), as string. |
elementName |
The name of the target element in the DVM, as string. |
defaultValue |
A default value to assign to the target element if no value is found, 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
This function returns a string by looking up the value for the target element in the DVM, where the value for the source element is equal to the source value. The source value is an XPath expression bound to the source document of the XSLT transformation. The expression is evaluated during the transformation and the result value is passed as the source value for lookup.
An exception can occur for the following reasons:
The DVM map with a given name is not found.
The specified elements are not found.
The specified source value is empty.
Example
The following code looks up the value of the Short element in the StateCodes DVM map corresponding to the Calif value in the Abbrev element:
dvm:lookup-dvm("StateCodes","Abbrev","Calif","Short","CouldNotBeFound", True)