Below is the example of using the SetCube operation to set up aggregation by cube calendar dimension levels. The request contains cube moniker, the pattern indicating whether it is necessary to add settings of aggregation by dimension and updated metadata containing these settings. The response contains updated information about cube display versions.
{
"SetCube" :
{
"tCube" :
{
"id" : "S1!M!S!C1"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"dests" : "Change",
"dest" :
{
"dims" : "Change",
"dim" :
{
"aggregations" : "Add"
}
}
},
"meta" :
{
"dests" :
{
"its" :
{
"it" :
[
{
"k" : "1",
"dims" :
{
"its" :
{
"it" :
[
{
"k" : "112",
"aggs" :
{
"its" :
{
"it" :
[
{
"k" : "0",
"factKey" : "1",
"isChrono" : "true",
"chronoAggregator" :
{
"dimLevelsAggregators" :
{
"its" :
{
"it" :
[
{
"k" : "2",
"operation" : "UniformDisaggregation",
"sourceLevel" :
{
"k" : "1",
"id" : "YEARS",
"n" : "Years",
"vis" : "true"
}
}
]
}
}
}
}
]
}
}
}
]
}
}
}
]
}
}
},
"metaGet" :
{
"obInst" : "true",
"dests" : "Get",
"dest" :
{
"all" : "true"
}
}
}
}
}
{
"SetCubeResult" :
{
"id" :
{
"id" : "S1!M!S!C1"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "34",
"@hf" : "0",
"i" : "STD_CUBE",
"n" : "Cube",
"k" : "5857",
"c" : "1281",
"p" : "5845",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"isPermanent" : "1",
"isTemp" : "0"
}
},
"dirty" : "0",
"dests" :
{
"its" :
{
"it" :
[
{
"k" : "1",
"id" : "STD_CUBE",
"n" : "Cube",
"vis" : "1",
"isDefault" : "1",
"hideTrivialFactDimension" : "0",
"selSetOriginalOnly" : "0",
"useMultiAttrTable" : "0",
"datasets" :
{
"its" :
{
"it" :
[
{
"k" : "5878",
"id" : "OBJ5877",
"n" : "Table",
"vis" : "1",
"aggrType" : "Server",
"useSubqueryOptimization" : "1"
}
]
}
},
"dims" :
{
"its" :
{
"it" :
[
{
"k" : "5858",
"id" : "FACTS",
"n" : "Facts",
"vis" : "1",
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "34",
"@hf" : "0",
"i" : "FACTS",
"n" : "Facts",
"k" : "5858",
"c" : "1028",
"p" : "5857",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
},
"aggsPresent" : "0",
"hierAggsPresent" : "0"
},
{
"k" : "112",
"id" : "CALENDAR",
"n" : "Calendar",
"vis" : "1",
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "6",
"@hf" : "0",
"i" : "CALENDAR",
"n" : "Calendar",
"k" : "112",
"c" : "1026",
"p" : "103",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
},
"aggs" :
{
"its" :
{
"it" :
[
{
"k" : "4294967295",
"id" : "CHRONOLOGICALMATRIXAGGREGATOR",
"n" : "Chronological aggregator",
"vis" : "1",
"factKey" : "1",
"isChrono" : "1",
"operations" :
{
"its" :
{
"it" :
[
{
"k" : "0",
"n" : "No"
},
{
"k" : "1",
"n" : "Chronological average"
},
{
"k" : "2",
"n" : "Uniform disaggregation"
}
]
}
},
"chronoAggregator" :
{
"defaultLevelAggregation" :
{
"k" : "4294967295",
"vis" : "1",
"includeChildren" : "1",
"useDefaultLevelAggregation" : "0",
"operation" : "None",
"resultToSourceLevel" : "1",
"resultToThisLevel" : "1"
},
"dimLevelsAggregators" :
{
"its" :
{
"it" :
[
{
"k" : "2",
"id" : "HALF_YEARS",
"n" : "Half-years",
"vis" : "1",
"includeChildren" : "0",
"useDefaultLevelAggregation" : "0",
"operation" : "UniformDisaggregation",
"sourceLevel" :
{
"k" : "1",
"id" : "YEARS",
"n" : "Years",
"vis" : "1"
},
"resultToSourceLevel" : "1",
"resultToThisLevel" : "0"
}
]
}
},
"levelAggsPresent" : "1"
}
}
]
}
},
"aggsPresent" : "1",
"hierAggsPresent" : "0"
},
{
"k" : "116",
"id" : "DIM_1",
"n" : "Dim_1",
"vis" : "1",
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "3",
"@hf" : "0",
"i" : "DIM_1",
"n" : "Dim_1",
"k" : "116",
"c" : "1025",
"p" : "103",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
},
"aggsPresent" : "0",
"hierAggsPresent" : "0"
},
{
"k" : "991",
"id" : "DIM_2",
"n" : "Dim_2",
"vis" : "1",
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "0",
"@hf" : "0",
"i" : "DIM_2",
"n" : "Dim_2",
"k" : "991",
"c" : "1025",
"p" : "10529",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
},
"aggsPresent" : "0",
"hierAggsPresent" : "0"
}
]
}
},
"dimBinds" :
{
"its" :
{
"it" :
[
{
"dimKey" : "5858",
"datasets" :
{
"it" :
{
"dsKey" : "5878"
}
}
},
{
"dimKey" : "112",
"datasets" :
{
"it" :
{
"dsKey" : "5878",
"indexKey" : "7",
"indexBlockKey" : "3",
"attrs" :
{
"it" :
{
"attrKey" : "2",
"fieldId" : "V_DATE",
"formula" : "OBJ5877.V_DATE"
}
}
}
}
},
{
"dimKey" : "116",
"datasets" :
{
"it" :
{
"dsKey" : "5878",
"indexKey" : "121",
"indexBlockKey" : "120",
"attrs" :
{
"it" :
{
"attrKey" : "118",
"fieldId" : "DIM1_ID",
"formula" : "OBJ5877.DIM1_ID"
}
}
}
}
},
{
"dimKey" : "991",
"datasets" :
{
"it" :
{
"dsKey" : "5878",
"indexKey" : "1001",
"indexBlockKey" : "1000",
"attrs" :
{
"it" :
{
"attrKey" : "993",
"fieldId" : "DIM2_ID",
"formula" : "OBJ5877.DIM2_ID"
}
}
}
}
}
]
}
},
"factBinds" :
{
"its" :
{
"it" :
[
{
"factKey" : "1",
"dsKey" : "5878",
"formula" : "OBJ5877.VALUE",
"aggrType" : "None"
},
{
"factKey" : "1",
"dsKey" : "5878",
"formula" : "",
"aggrType" : "None"
}
]
}
},
"calcBinds" :
{
"its" :
{
"it" :
[
{
"factKey" : "1",
"formula" : "",
"revFactKey" : "",
"revFormula" : "",
"timeLagLevel" : "None",
"timeForwardLag" : "0",
"timeBackwardLag" : "0",
"includeInSelection" : "0",
"calcMethod" : "BySelection"
},
{
"factKey" : "1",
"formula" : "",
"revFactKey" : "",
"revFormula" : "",
"timeLagLevel" : "None",
"timeForwardLag" : "0",
"timeBackwardLag" : "0",
"includeInSelection" : "0",
"calcMethod" : "ByMatrix"
}
]
}
},
"relations" :
{
"its" : ""
},
"selControl" :
{
"its" : "",
"options" : "",
"isEmpty" : "1"
}
}
]
}
},
"supportsRub" : "0"
}
}
}
public static SetCubeResult AddAggregation(CubeId moniker, DmMetadata calendarDim)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSet = new SetCube()
{
tArg = new SetCubeArg()
{
//Pattern that indicates whether cube aggregation must be set up
pattern = new CubeMdPattern()
{
dests = ListOperation.Change,
dest = new CubeDestPattern()
{
dims = ListOperation.Change,
dim = new CubeDimPattern()
{
aggregations = ListOperation.Add
}
}
},
//Updated metadata containing aggregation parameters:
meta = new CubeMd
{
dests = new CubeDests()
{
its = new CubeDest[]
{
new CubeDest()
{
k = 1,
dims = new CubeDims()
{
its = new CubeDim[]
{
new CubeDim()
{
k = calendarDim.descr.k,
aggs = new MatrixAggregators()
{
its = new MatrixAggregator[]
{
new MatrixAggregator()
{
factKey = "1",
isChrono = true,
chronoAggregator = new ChronoMatrixAggregator()
{
dimLevelsAggregators = new ChronoDimLevelAggregators()
{
its= new ChronoDimLevelAggregator[]
{
new ChronoDimLevelAggregator()
{
k = calendarDim.levs[1].k, // Consumer level
operation = ChronologicalAggregatorOper.UniformDisaggregation,
sourceLevel = calendarDim.levs[0] //Source level
}
}
}
}
}
}
}
}
}
}
}
}
}
},
metaGet = new CubeMdPattern()
{
dests = ListOperation.Get,
dest = new CubeDestPattern()
{
all = true
}
}
},
tCube = moniker
};
//Change cube
var result = somClient.SetCube(tSet);
return result;
}
See also: