DimSrv.setHierarchy

Syntax

setHierarchy(dim: PP.Mb.DimSource, args: Object, callback: Function | PP.Delegate, errorCallback: Function | PP.Delegate);

Parameters

dim. Dictionary.

args. Operation arguments. An object must contain the following fields: hierId - hierarchy identifier.

callback. Callback function.

errorCallback. Callback function on error.

Description

The setHierarchy method sets alternative dictionary hierarchy.

Example

Executing the example requires an instance of the DimSrv class named dimService (see DimSrv constructor). Set the hierarchy obtained from metadata and output its name:

// Get dictionary metadata
var meta;
var func = function(sender, args){
    meta = JSON.parse(args.ResponseText).GetDimMetadataResult;
}
dimService.getMetadata(dim, {}, func);
var args = {
    hierId: meta.data.hiers.it[0].id,
}
var func = function(sender, args) {
    var res = JSON.parse(args.ResponseText);
    var hier = res.GetDimMetadataResult.data.selection.hierarchy;
    console.log("Name of set hierarchy: " + hier.n);
}
dimService.setHierarchy(dim, args, func);

As a result the console displays name of the set hierarchy:

Name of the set hierarchy: Socio-economic indicators

See also:

DimSrv