DimSrv.selectGroup

Syntax

selectGroup(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; groupId - group identifier; limitToGroup - indicates if elements that are not in the group are deleted, if the argument is set to True, elements that are not in the group are deleted; fireEvent - indicates if the DimSrv.SelectionChanged event is called; if the parameter is set to True, the event is called.

callback. Callback function.

errorCallback. Callback function on error.

Description

The selectGroup method selects group elements.

Example

Executing the example requires an instance of the DimSrv class named dimService (see DimSrv constructor). Add a handler for dictionary metadata obtain event. Select group elements with the identifier obtained from dictionary metadata:

// Add a handler for dictionary metadata obtain event
dimService.DimGetMetadataComplete.add(function(sender, args) {
    console.log("Dictionary metadata is successfully obtained");
    console.log(args);
});
// Get dictionary metadata
var meta;
var func = function(sender, args){
    meta = JSON.parse(args.ResponseText).GetDimMetadataResult;
}
dimService.getMetadata(dim, {}, func);
// Select group elements from metadata
var args = {
    groupId: meta.data.groups.it[0].id
}
dimService.selectGroup(dim, args);
var func = function(sender, args) {
    var res = JSON.parse(args.ResponseText);
    var elems = res.GetDimElementsResult.els.e;
    console.log("Names of selected elements:");
    var k = 0;
    var str = elems[0].n + " ";
    for (var i = 1; i < elems.length; i++) {
        if (k < 3) {
            str += elems[i].n + " ";
            k++;
        } else {
            console.log(str);
            str = elems[i].n + " ";
            k = 0;
        }
    }
}
dimService.getAllSelectedEls(dim, func);

After executing the example the console displays the selected elements:

Dictionary metadata is successfully obtained

Names of selected elements:

I quarter 1990 II quarter 1990 III quarter 1990 IV quarter 1990

I quarter 1991 II quarter 1991 III quarter 1991 IV quarter 1991

I quarter 1992 II quarter 1992 III quarter 1992 IV quarter 1992

I quarter 1993 II quarter 1993 III quarter 1993 IV quarter 1993

I quarter 1994 II quarter 1994 III quarter 1994 IV quarter 1994

I quarter 1995 II quarter 1995 III quarter 1995 IV quarter 1995

I quarter 1996 II quarter 1996 III quarter 1996 IV quarter 1996

I quarter 1997 II quarter 1997 III quarter 1997 IV quarter 1997

I quarter 1998 II quarter 1998 III quarter 1998 IV quarter 1998

I quarter 1999 II quarter 1999 III quarter 1999 IV quarter 1999

I quarter 2000 II quarter 2000 III quarter 2000 IV quarter 2000

I quarter 2001 II quarter 2001 III quarter 2001 IV quarter 2001

I quarter 2002 II quarter 2002 III quarter 2002 IV quarter 2002

I quarter 2003 II quarter 2003 III quarter 2003 IV quarter 2003

I quarter 2004 II quarter 2004 III quarter 2004 IV quarter 2004

 

Process the event of dictionary clearing and add an element group to its metadata:

// Process the DimCleared event
dimService.DimCleared.add(function(sender, args) {
    console.log("Dictionary is cleared");
};
var callback = function(sender, args) {
    console.log("An element group is added to dictionary metadata");
};
// Add an element group to dictionary metadata
dimService.setElementsGroup(dim, {groupId: "OBJ10901"}, callback);

After executing the example the console displays messages about adding an element group to dictonary metadata and dictionary clearing:

An element group is added to dictionary metadata

Dictionary is cleared

See also:

DimSrv