In Strategy, a derived Transformation Metric will be derived from the metrics that already exist on the workingset. Using the Strategy Java Web SDK 9.0.1, it is possible to programmatically create a derived transformation metric.
To accomplish this, use the following methods:
WebReportManipulation.addTransformationMetric(WebTransformationMetric)
WebReportManipulation.GetNewTransformationMetric(WebMetric, WebObjectInfo)
Use the following code as a guide for accomplishing this customization:
WebReportInstance rInstance = rSource.getNewInstance(reportID);
WebReportManipulation manip= rInstance.getReportManipulator();
WebTemplate template = rInstance.getTemplate();
WebTemplateMetrics wtms = template.getTemplateMetrics();
WebTemplateMetric wtm = wtms.get(0);
int position = wtm.getPosition();
WebMetric metric = wtm.getMetric();
//get transformation role
WebObjectinfo transObj = oFactory.ObjectSource.GetObject("7ABF2FE7EEEFAF297A3DA7BE28461E3C",DssXmlTypeRole)
WebTransformationMetric tMetric = manip.GetNewTransformationMetric(metric, transObj);
//set properties on the new transformation metric
tMetric.setFormulaType(EnumDSSXMLMetricFormulaType.DssXmlMetricFormulaDifference);
rInstance = manip.addTransformationMetric(tMetric );
CUSTOMIZATION WARNING:
This customization is provided as a convenience to Strategy users and is only directly applicable to the version stated. While this code may apply to other releases directly, Strategy Technical Support makes no guarantees that the code provided will apply to any future or previous builds. In the event of a code change in future builds, Strategy Technical Support makes no guarantee that an updated version of this particular customization will be provided. In the event of a code change in future builds, Strategy may not be able to provide additional code on this matter even though this customization is provided at this time for this specific build. For enhancements to this customization or to incorporate similar functionality into other versions, contact your Account Executive to inquire about Strategy Consulting assistance.