Transforming data by using CDT

Users with the Developer role can use CDT to automatically transform certain values in the source environment into target-appropriate values by specifying transformations in the CDT preferences XML section under the Configuration tab in the Self Service. These transformations are run on the source data before they are deployed into the target environment.

Typically, development and production environments have different values for network settings such as server names and IP addresses. Some configuration data tables in IBM® Sterling Order Management System store host names, IP addresses, and URLs. While these values are valid for your source environment, when you deploy this data into a target environment, these values must be updated.

The CDT transformation logic can also be used to transform a value to null, if the corresponding column is nullable. For example, the following specification in the <runtime>/resources/ydkresources/ydkprefs.xml file can be used to update the value of Column1 to null in Table1 of the target database, if Column1 is nullable and the value in the source database is value1.
 <Transformations>
              <Table Name="table1">
                 <Column Name="column1">
                    <Transform Match="value1" Replace=""/>
                  </Column>
               </Table>
 </Transformations>

The value of Replace, if specified as "" or "NULL", is treated as null and the column in the target database is set to null.

The CDT ignores all null-valued columns when you export configurations to XML. But null is a valid value for certain OMS configurations. As CDT ignores such columns, they are not deployed on the target database in the XML-based deployment approach. To solve this problem, configure a CDT transformation to transform null to a non-null value when you export the configurations from the source environment to XMLs. Later, the same value must be transformed to null, when the XMLs are imported to the target environment.

For example, null is a valid value for the FUTURE_INVENTORY_WINDOW column in the YFS_SOURCING_RULE_DTL table. Add the following specification in the ydkprefs.xml file, under the corresponding SourceTargetPair, to transform all the null values in the FUTURE_INVENTORY_WINDOW column to 999.
<Transformations>
             <Table Name="YFS_SOURCING_RULE_DTL">
                 <Column Name="FUTURE_INVENTORY_WINDOW">
                     <Transform Match="" Replace="999"/>
                 </Column>
             </Table>
</Transformations>
To convert 999 to null on the target database, specify the reverse transformation in the respective SourceTargetPair of the ydkprefs.xml file as follows:
<Transformations>
              <Table Name="YFS_SOURCING_RULE_DTL">
                 <Column Name="FUTURE_INVENTORY_WINDOW">
                    <Transform Match="999" Replace=""/>
                 </Column>
              </Table>
</Transformations>

By specifying the transformations, you can ensure that all the null values in the FUTURE_INVENTORY_WINDOW column are deployed correctly to the target database.