Configuring the Reformat component for standard attributes

A Reformat component is used to transform incoming configuration data into a Standard Attribute Description Record.

The transformation is done by this CTL function in the Reformat component:
integer n = 1;
integer aggrKey = 0;

// Transforms input record into output record.
function integer transform() {
  string searchBool = "";
  string saRecord = "<mdex:record xmlns=\"\">";
  saRecord = saRecord + "<mdex-property_Key>" + $0.Key + "</mdex-property_Key>";
  saRecord = saRecord + "<mdex-property_DisplayName>" + $0.DisplayName + "</mdex-property_DisplayName>";

  // Lower case the boolean in the CSV file
  searchBool = lowerCase($0.TextSearch);
  saRecord = saRecord + "<mdex-property_IsTextSearchable>" + searchBool + "</mdex-property_IsTextSearchable>";

  saRecord = saRecord + "<system-navigation_Sorting>" + $0.SortOrder + "</system-navigation_Sorting>";

  $0.xmlString = saRecord + "</mdex:record>";

  // Batch up the web service requests.
  $0.singleAggregationKey = aggrKey;
  n++;
  if (n % 15 == 0) {
    aggrKey++;
  }

  return ALL;
}

The function builds each Standard Attribute Description Record (SADR) using the configuration data in the input CSV file. Keep in mind that, if you wish, you can add more SADR property definitions; if you do so, be sure to update the input file for the additional input values.

To configure the Reformat component in the standard attribute schema graph:

  1. In the Graph window, double-click the Reformat component. The Reformat Edit Component dialog is displayed.

  2. Single-click in the Transform field and then click the ... button. The Transform editor is displayed.
  3. Click the Source tab in the editor. The CTL template for the transform function is shown.

  4. Modify the CTL script so that it looks like the CTL example above. You may see the message "Cannot write to output port '0'" at the bottom of the editor. Assuming you have not made any coding errors, you may disregard the message for now.
  5. When you have finished your changes in the Transform editor, click OK. If you see the error "Transformation contains syntax errors! Accept it anyway?" in a pop-up message, click Yes.
  6. Optionally, you can change the Component name field to provide a customized name (such as "Transform Attribute Metadata") for this component.
  7. Click OK to apply your configuration changes.
  8. Save the graph.

The two messages listed above should disappear once you configure the Reformat component Edge metadata.