A Reformat component is used to transform incoming configuration data into a precedenceRule record.
function integer transform() { string prRecord = ""; string isLeaf = ""; // Begin building the precedenceRule record prRecord = "<mdex:precedenceRule "; // Add the name of the rule. prRecord = prRecord + "key='" + $0.Key + "' "; // Add the name of the trigger attribute prRecord = prRecord + "triggerAttributeKey='" + $0.TriggerAttribute + "' "; // Add mval or pval trigger value only if present in the input file if ($0.TriggerValue != null && !$0.TriggerValue.isBlank()) { prRecord = prRecord + "triggerAttributeValue='" + $0.TriggerValue + "' "; } // Add the name of the target attribute prRecord = prRecord + "targetAttributeKey='" + $0.TargetAttribute + "' "; // Add the boolean that specifies if the trigger is a leaf // Lower case the boolean in the CSV file isLeaf = lowerCase($0.isLeafTrigger); prRecord = prRecord + "isLeafTrigger='" + isLeaf + "'/>"; // Append the record to the xmlString variable, which stores all the rules $0.xmlString = prRecord; return ALL; }
When it runs, the component will build one or more precedenceRule elements and send them in the xmlString property to the WebServiceClient component in the graph.
To configure the Reformat component in the precedence rules graph:
The two messages listed above should disappear once you configure the Reformat component Edge metadata.