Below is the example of using the SetCube operation to change calculated cube structure. The following is executed in the calculated cube: the first dimension is moved, the type of coordinates, by which calculation is executed, it is determined whether empty values are saved to the cube. The request contains the necessary settings for making changes. The response contains the updated information about calculated cube and its dimensions.
{
"SetCube" :
{
"tCube" :
{
"id" : "S1!M!S!C2"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"dims" : "Change",
"calcCube" : "true"
},
"meta" :
{
"dims" :
{
"its" :
{
"it" :
[
{
"k" : "6964",
"id" : "FACTS",
"vis" : "true",
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "false",
"@isLink" : "false",
"@ver" : "3",
"@hf" : "false",
"i" : "FACTS",
"n" : "Facts",
"k" : "6964",
"c" : "1028",
"p" : "6962",
"h" : "false",
"hasPrv" : "false",
"ic" : "false",
"trackElementDependents" : "false"
}
},
{
"k" : "112",
"id" : "CALENDAR",
"vis" : "true",
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "false",
"@isLink" : "false",
"@ver" : "8",
"@hf" : "false",
"i" : "CALENDAR",
"n" : "Calendar",
"k" : "112",
"c" : "1026",
"p" : "103",
"h" : "false",
"hasPrv" : "false",
"ic" : "false",
"trackElementDependents" : "false"
}
},
{
"k" : "116",
"id" : "DIM_1",
"vis" : "true",
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "false",
"@isLink" : "false",
"@ver" : "3",
"@hf" : "false",
"i" : "DIM_1",
"n" : "Dim_1",
"k" : "116",
"c" : "1025",
"p" : "103",
"h" : "false",
"hasPrv" : "false",
"ic" : "false",
"trackElementDependents" : "false"
}
},
{
"k" : "991",
"id" : "DIM_2",
"vis" : "true",
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "false",
"@isLink" : "false",
"@ver" : "1",
"@hf" : "false",
"i" : "DIM_2",
"n" : "Dim_2",
"k" : "991",
"c" : "1025",
"p" : "10529",
"h" : "false",
"hasPrv" : "false",
"ic" : "false",
"trackElementDependents" : "false"
}
}
]
},
"move" :
{
"indexFrom" : "0",
"indexTo" : "1"
}
},
"calcCube" :
{
"includeNulls" : "true",
"evaluateOnly" : "Selected"
}
},
"metaGet" :
{
"obInst" : "true",
"dims" : "Get",
"calcCube" : "true"
}
}
}
}
{
"SetCubeResult" :
{
"id" :
{
"id" : "S1!M!S!C2"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "5",
"@hf" : "0",
"i" : "CALC_CUBE",
"n" : "Calculated cube",
"k" : "6962",
"c" : "1282",
"p" : "5845",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0",
"isPermanent" : "1",
"isTemp" : "0"
}
},
"dirty" : "1",
"dims" :
{
"its" :
{
"it" :
[
{
"k" : "112",
"id" : "CALENDAR",
"vis" : "1",
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "8",
"@hf" : "0",
"i" : "CALENDAR",
"n" : "Calendar",
"k" : "112",
"c" : "1026",
"p" : "103",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0"
}
},
{
"k" : "6964",
"id" : "FACTS",
"vis" : "1",
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "3",
"@hf" : "0",
"i" : "FACTS",
"n" : "Facts",
"k" : "6964",
"c" : "1028",
"p" : "6962",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0"
}
},
{
"k" : "116",
"id" : "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",
"trackElementDependents" : "0"
}
},
{
"k" : "991",
"id" : "DIM_2",
"vis" : "1",
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "1",
"@hf" : "0",
"i" : "DIM_2",
"n" : "Dim_2",
"k" : "991",
"c" : "1025",
"p" : "10529",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0"
}
}
]
}
},
"calcCube" :
{
"factsDimId" : "S1!M!S!C2!FactDim",
"externalFactDimension" : "0",
"formulasDestinationVisible" : "1",
"cacheFormulas" : "1",
"includeNulls" : "1",
"evaluateOnly" : "Selected"
}
}
}
}
public static SetCubeResult ChangeCalculatedCubeStructure(CubeId moniker, CubeDim[] dims)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSet = new SetCube()
{
tArg = new SetCubeArg()
{
//Pattern
pattern = new CubeMdPattern()
{
calcCube = true,
dims = ListOperation.Change
},
//Updated metadata
meta = new CubeMd
{
calcCube = new CalcCubeMd()
{
evaluateOnly = CalcCubeEvaluateOnlyType.Selected,
includeNulls = true
},
dims = new CubeDims()
{
its = dims,
move = new ItemMoveInfo()
{
indexFrom = 0,
indexTo = 1
}
}
},
metaGet = new CubeMdPattern()
{
calcCube = true,
dims = ListOperation.Get
}
},
tCube = moniker
};
//Change cube structure
var result = somClient.SetCube(tSet);
return result;
}
See also: