DVM Utility Class Methods
This section describes the DVM utility class methods. The methods are discussed in alphabetical order.
Syntax
ExtractData (mapName, domainList, tempRecName, instance)
Description
You can use the DVM extract data function to generate and execute set-based SQL to extract DVM data into a specified table. Prior to data extraction, all data is removed from the temp table for the specified process instance. Element values are mapped to fields in the temp record using the order of the specified domain list followed by the element order specified in the value map definition. If no domains are specified, element values are mapped to fields in the temp record using only the element order specified in the value map definition. This function is expected to be used for processing large volumes of data. It provides an abstraction layer from the physical data persistence layer of the DVM framework.
The temp table has the following design constraints:
The first column will be PROCESS_INSTANCE.
The second column will be used for UniqueGUID (EOTF_COMMONELEMENT).
The remaining columns correspond to the elements in the specified domain list.
The temp table column names do not have to match the element names in the DVM.
The table should be keyed by ProcessInstance, UniqueGUID.
There may be a performance benefit from having an index on the elements of each specified domain.
Parameters
Parameter |
Description |
---|---|
mapName |
The name of static value map definition (DVM), as sting. |
domainList |
The name of the value map domain(s) to extract data for. Provide null or an empty array in this parameter to extract data for all domains in the map. |
tempRecName |
The name of the temp table to extract data into, as string. |
instance |
The number to use when qualifying process instance, as integer. |
Returns
Boolean indicating success or failure of the process.
Example
Local EOTF_CORE:DVM:Functions &dvm = create EOTF_CORE:DVM:Functions(); Local string &mapName = "States"; Local array of string &domainList = CreateArray("PS"); Local string &tempRecName = Record.HR_STATES_TAO; Local boolean &success = &dvm.ExtractData(&mapName, &domainList, &tempRecName, &instance);
Syntax
LookupValue (mapName, referenceElementName, referenceValue, elementName, defaultValue, needAnException)
Description
Locate the reference element value in a domain value map, and return the equivalent value for the specified element name. This form of DVM lookup is used to find a single reference element and return a single element value.
Parameters
Parameter |
Description |
---|---|
mapName |
Name of a static value map definition (DVM), as string. |
referenceElementName |
Name of an element in the DVM in which to look for a value, as string. |
referenceValue |
Value of an element in the DVM to look for, as string. |
elementName |
Name of the element in the DVM to return an equivalent value for, as string. |
defaultValue |
Default value to be returned if needAnException is false and an error occurs, as string. |
needAnException |
True to return error messages, false to return the default value. |
Returns
The equivalent value of elementName in the DVM, or the default value.
Example
This example is used to look up the value &guid1 in the UniqueGUID element of the &TestName DVM and return the equivalent value of element &EBS1.
Local string &returnValue = &dvm.LookupValue(&TestName, &UniqueGUID, &guid1, &EBS1, "Value not found.", True);
This example will look up a value that does not exist in element &EBS1 of the &TestName DVM to verify that the default value is returned when the NeedAnException parameter is false.
&returnValue = &dvm.LookupValue(&TestName, &EBS1, "NotFound", &UniqueGUID, &ValueNotFound, False);
Syntax
LookupValue1M (mapName, referenceElementName, referenceValue, elementName, needAnException)
Description
Locate the reference element value in a domain value map, and return the equivalent values of the specified element name as an NVP list. This form of DVM lookup is used to find a single reference element and return one to many equivalent values for the specified element.
Parameters
Parameter |
Description |
---|---|
mapName |
Name of a static value map definition (DVM), as string. |
referenceElementName |
Name of an element in the DVM in which to look for a value, as string. |
referenceValue |
Value of an element in the DVM to look for, as string. |
elementName |
Name of the element in the DVM to return equivalent values for, as string. |
needAnException |
True to return error messages, false to return the default values. |
Returns
An array of string containing the equivalent values of elementName in the DVM.
Example
This example will look up value &guid1 in the UniqueGUID element of the &TestName DVM and return the equivalent value of element &EBS1 :
&returnValue = &dvm.LookupValue1M(&TestName, &UniqueGUID, &guid1, &EBS1, True);
This example will look up a value that does not exist in the UniqueGUID element of the &TestName DVM to verify that no value is returned when the NeedAnException parameter is false:
&returnValue = &dvm.LookupValue1M(&TestName, &UniqueGUID, "NotFound", &EBS1, False);
Syntax
LookupValueNVP (mapName, referenceDomain, referenceNVP, targetDomain, defaultNVP, needAnException
Description
Locate the reference domain element values in a DVM, and return 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 |
Name of a static value map definition (DVM), as string. |
referenceDomain |
Name of a domain in the DVM in which to look for a value, as string. |
referenceNVP |
Name value pairs of elements and values in the DVM domain to look for, as an array of DataElement. |
targetDomain |
Name of the domain to return equivalent values for, as string. |
defaultNVP |
Default values (NVPs) to be returned if needAnException is false and an error occurs, as an array of DataElement. |
needAnException |
True to return error messages, false to return an NVP with the default values. |
Returns
An array of DataElement. Name value pairs containing the equivalent values for the elements in the target domain, or the default values.
Example
This example is used to look up value &guid1 in the UniqueGUID domain of the &TestName DVM and return the equivalent values for the &RTK domain:
Local array of EOTF_CORE:Common:DataElement &UniqueGUIDrequestValues = CreateArray(create EOTF_CORE:Common:DataElement(&UniqueGUID)); &UniqueGUIDrequestValues [1].value = &guid1; Local array of EOTF_CORE:Common:DataElement &returnValue = &dvm.LookupValueNVP(&TestName, &UniqueGUID, &UniqueGUIDrequestValues, &RTK, &DefaultRTKValues, True);