DimSrv.setSchema

Syntax

setSchema(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: selId - selection moniker; schemaId - schema indicator; applyOnlyOnce - indicates if a schema is set once; if the argument is set to True, schema can be set only once; applyImmediate - indicates if a schema is immeadiately applied; if the argument is set to True, schema is applied immediately.

callback. Callback function.

errorCallback. Callback function on error.

Description

The setSchema method sets selection schema for a dictionary.

Example

Executing the example requires an instance of the DimSrv class named dimService (see DimSrv constructor). Select the schema obtained from metadata, by which all dictionary elements are selected:

// Get dictionary metadata
var meta;
var func = function(sender, args){
    meta = JSON.parse(args.ResponseText).GetDimMetadataResult;
}
dimService.getMetadata(dim, {}, func);
var args = {
    schemaId: meta.data.schemas.it[0].id,
}
dimService.setSchema(dim, args);
// Get all selected dimension elements
var func = function(sender, args) {
    var res = JSON.parse(args.ResponseText);
    var elems = res.GetDimElementsResult.els.e;
    console.log("Number of selected elements: " + elems.length);
}
dimService.getAllSelectedEls(dim, func);

As a result the console displays the number of selected elements:

Number of selected elements: 272

See also:

DimSrv