EaxMdService.Transformation

Syntax

Transformation: JSON;

Description

The Transformation property determines transformations of the services used to work with express report.

Comments

Use the setTransformation method to set the property value, and the getTransformation method to get the property value. Property value cannot be set from JSON.

Parameters of the setTransformation method:

- report: PP.Exp.EaxAnalyzer. Express report model, for which transformations are set.

- transformations: Array of Object. Array of transformation objects.

- transformOperation: PP.Exp.TransfOperationType. Operation type.

- returnTransformations: Boolean. Indicates if all transformations are obtained. If the parameter is set to True, all service transformations are returned to callback function.

- callback: Function. Callback function.

Parameters of the getTransformation method:

- report: PP.Exp.EaxAnalyzer. Express report model, for which transformations are set.

- dimKey: Number. Dimension key.

- dimElKey: Number. Dimension element key.

- transfKey: Number. Transformation key: If the parameter is set to Null, all service transformations are returned.

- callback: Function. Callback function.

Example

Executing the example requires that the HTML page contains the TransformDialog named dialog (see Example of Creating the TransformDialog Component page). The dimension with the 109 key must be opened, the element with the 225 key must be in this dimension. Eigenvalues can be used as these keys.

Add a new transformation to express report service, then determine the formula corresponding to this transformation:

// Get express report document
var source = expressBox.getSource();
// Get a service used to work with express report
var service = expressBox.getSource().getPPService();
var transformation;
var dimKey = 109;
var elemId = 225;
// Add a new transformation to express report service
transformation = {
    enabled: True,
    expression: "2010",
    vis: True,
    elemId: elemId,
    dimkey: dimKey,
    k: 0,
    isFilter: False,
    formulaTransform: {
        calculationDirection: "Forward",
        calculationType: "Serie"
    }
}
// Set this transformation
service.setTransformation(source, [transformation], PP.Exp.TransfOperationType.Add, False);
// Get transformation
service.getTransformation(expressBox.getSource(), dimKey, elemId, null, function(sender,args) {    
    var res = args && args.ResponseText && JSON.parse(args.ResponseText);    
    var transformers = this._Items = PP.getProperty(res, 'GetEaxMdResult.meta.transformations.its.Item') || [];
    transformation = transformers[0];
    if(transformation) {
        console.log("Calculation formula for the %s element: %s", elemId, transformation.expression);
    }
});

After executing the example the browser console displays the calculation formula for the element of the 225 key:

Calculation formula for the 225 element: 2010

Specify the name for the created transformation and save its settings:

// Set transformation name
transformation.name = "Custom transformation";
if(transformation.isFilter) {
    // Refresh transformation settings
    service.updateFilterTransformation(source, transformation);
} else {
    // Save transformation settings
    service.setTransformationState(source, PP.Exp.TransfType.CalcTransformations, PP.Exp.TransfState.Save, dimKey, elemId);
}
// Determine transformation name
var tKey;
service.getTransformation(expressBox.getSource(), dimKey, elemId, null, function(sender, args) {    
    var res = args && args.ResponseText && JSON.parse(args.ResponseText);    
    var transformers = this._Items = PP.getProperty(res, 'GetEaxMdResult.meta.transformations.its.Item') || [];    
    console.log("Transformation name: " + transformers[0].name);
    tKey = transformers[0].k;
});

As a result the console displays name of the refreshed transformation:

Transformation name: Custom transformation

 

Set a new transformation position in the corresponding collection:

// Set a new transformation position
service.setTransformationPos(source, tKey, 1);

As a result, the transformation filter is moved in the collection.

See also:

EaxMdService