FindCodeSetValues function
Syntax
FindCodeSetValues(CodesetName, &NameValuePairs, SourceNodeName, TargetNodeName)
Description
Use the FindCodeSetValues function to find a list of code set name-value pairs. Code sets are primarily used with data value translations as part of a transformation.
Parameters
| Parameter | Description |
|---|---|
|
CodeSetName |
Specify the name of the code set you want to find, as a string. |
|
&NameValuePairs |
Specify a 2 dimensional array containing the name value pairs in the specified code set that you want to use. |
|
SourceNodeName |
Specify the name of the source (initial) node used in the data transformation. |
|
TargetNodeName |
Specify the name of the target (result) node used in the data transformation. |
Returns
A two-dimensional array of any.
Example
This example checks the specified CodeSet values, with the name value pairs of "locale/en_us" and "uom/box". It takes the returned array and adds XML nodes to the document. The XML nodes names are the unique names of the CodeSet value, and the XML node value is the corresponding return value.
/* Get the data from the AE Runtime */
Local TransformData &incomingData = %TransformData;
/* Set a temp object to contain the incoming document */
Local XmlDoc &tempDoc = &incomingData.XmlDoc;
/* Declare the node */
Local XmlNode &tempNode;
/* Create an array to hold the name value pairs */
Local array of array of string &inNameValuePairsAry;
/* Clear out the doc and put in a root node */
If (&tempDoc.ParseXmlString("<?xml version=""1.0""?><xml/>")) Then
/* Load the array with some values */
&inNameValuePairsAry = CreateArray(CreateArray("locale", "en_us"),
CreateArray("uom", "box"));
/* Find the codeset values */
&outAry = FindCodeSetValues("PS_SAP_PO_01", &inNameValuePairsAry,
"SAP_SRC", "PSFT_TGT");
/* Local XmlNode &tempNode; */
/* Make sure something was returned */
If &outAry.Len > 0 Then
/* Loop through the quantities and make sure they are all above 5 */
For &i = 1 To &outAry.Len
/* Add the current system date to the working storage*/
&tempNode = &tempDoc.DocumentElement.AddElement(&outAry [&i][1]);
&tempNode.NodeValue = &outAry [&i][2];
End-For;
End-If;
End-If;