Strategy ONE
Converting a Metric into a Derived Metric
This example converts an existing base metric from the template to a derived metric.
Code sample
1. WebReportInstance rInstance = rSource.getNewInstance(reportID);
2. WebReportManipulation rManipul = rInstance.getReportManipulator();
3. WebTemplate template = rInstance.getTemplate();
4. WebTemplateMetrics wtms = template.getTemplateMetrics();
5. WebTemplateMetric wtm = wtms.get(0);
6. WebMetric metric = wtm.getMetric();
7. rInstance = rManipul.convertIntoDerivedMetric(metric);
Explanation
Lines 1 and 2 create and retrieve the WebReportManipulation object required to add the derived metric. Lines 3-6 get the metric from the template. In line 7, this metric is then converted into a derived metric by calling the convertIntoDerivedMetric method. Note that if the metricID is known, the metric object can be obtained from the object source instead of the template.
