SetCalculatedCubeFormulas

Syntax

bool SetCalculatedCubeFormulas(CubeId tCube, SetCalculatedCubeFormulasRes tArg)

Parameters

tCube. Opened calculated cube instance moniker.

tArg. Parameters of calculated cube formulas changes.

Description

The SetCalculatedCubeFormulas operation changes formulas for calculated cube.

Comments

To execute the operation, in the tCube field specify calculated cube instance moniker, and in the tArg field specify change parameters of formulas list. Get calculated cube instance moniker using the OpenCube operation.

In the tArg.its field it is required to create an element where in the dimIds field set up change monikers creating cube coordinate. The list of dimensions can be obtained using the GetCube operation or on opening cube using the OpenCube operation, if corresponding template is selected. Next, it is required to open all dimensions using the OpenDim operation and create a selection using the ChangeDimSelection operation. The obtained selection will determine cube coordinate that will be used to change formulas. In the formulas field create a formula or several formulas, if management of formulas actual period is set up in the cube. To save changes in formulas , use the SaveCalculatedCubeFormulas operation.

The operation result in the logical True if the formulas were changed successfully.

Example

Below is the example of changing formulas by specified coordinate of calculated cube. The request contains cube instance moniker and monikers of dimensions creating cube coordinate. Selection is pre-configured by dimensions. The formula expressions is also sent. The response contains whether formula is successfully changed.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SetCalculatedCubeFormulas xmlns="http://www.fsight.ru/PP.SOM.Som">
<tCube xmlns="">
  <id>S1!M!S!C1</id>
  </tCube>
<tArg xmlns="">
<its>
<it>
<dimIds>
<its>
<it>
<dimId>
  <id>S1!M!S!S2</id>
  </dimId>
  </it>
<it>
<dimId>
  <id>S1!M!S!S3</id>
  </dimId>
  </it>
<it>
<dimId>
  <id>S1!M!S!S4</id>
  </dimId>
  </it>
  </its>
  </dimIds>
<formulas>
<formula>
<its>
<it>
  <expression>CUBE_SOURCE[0,0,7]</expression>
  </it>
  </its>
  </formula>
  </formulas>
  </it>
  </its>
  </tArg>
  </SetCalculatedCubeFormulas>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
  <SetCalculatedCubeFormulasResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">1</SetCalculatedCubeFormulasResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"SetCalculatedCubeFormulas" :
{
"tCube" :
{
"id" : "S1!M!S!C1"
},
"tArg" :
{
"its" :
{
"it" :
[
{
"dimIds" :
{
"its" :
{
"it" :
[
{
"dimId" :
{
"id" : "S1!M!S!S2"
}
},
{
"dimId" :
{
"id" : "S1!M!S!S3"
}
},
{
"dimId" :
{
"id" : "S1!M!S!S4"
}
}
]
}
},
"formulas" :
{
"formula" :
[
{
"its" :
{
"it" :
[
{
"expression" : "CUBE_SOURCE[0,0,7]"
}
]
}
}
]
}
}
]
}
}
}
}

JSON response:

{
"SetCalculatedCubeFormulasResult" : "1"
}
public static bool SetCalcCubeFormulas(CubeId moniker, OpenId[] dimMonikers)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSet = new SetCalculatedCubeFormulas()
{
tArg = new SetCalculatedCubeFormulasRes()
{
its = new GetCalculatedCubeCoordFormula[]
{
new GetCalculatedCubeCoordFormula()
{
dimIds = new OpenIds()
{
its = dimMonikers
},
formulas = new CalculatedCubeFormulas()
{
formula = new CltCubeFormulas()
{
its = new CalculatedCubeFormula[]
{
new CalculatedCubeFormula()
{
expression = "CUBE_SOURCE[0,0,7]"
}
}
}
}
}
}
},
tCube = moniker
};
//Change calculated cube formulas
var result = somClient.SetCalculatedCubeFormulas(tSet);
return result;
}

See also:

Working with Cubes