Adding Calculation Algorithm for Data Slice

Below is the example of adding a calculation algorithm for a data slice in a regular report. The request contains moniker for working with calculation algorithms of data slice, description of the added algorithm and its work settings. The response contains whether an algorithm is added successfully.

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">
<UpdateDataAreaExternalTransformations xmlns="http://www.fsight.ru/PP.SOM.Som">
  <mon xmlns="">FPJHEGEAILDDGOAEBNPJEFNNPNNPCPAELKNIOBNJKIPKLKBE!M!S!PDFCFFHEAILDDGOAECGFLOGBJGLOFCJHEFKJBCNDOFDGMOMON!DataArea!DataSources!1!DataSourceSlices!1!ExternalTransformations</mon>
<tArg xmlns="">
<its>
<it>
<action>
  <operation>Add</operation>
  </action>
<externalTransformation>
  <k>-1</k>
  <enabled>true</enabled>
  <saveDataOption>false</saveDataOption>
  <calculationPeriodMode>0</calculationPeriodMode>
  <calculationMode>1</calculationMode>
<algorithm isShortcut="false" isLink="false" ds="" hf="false" ver="4">
  <i>OBJ339507</i>
  <n>Calculation algorithm</n>
  <k>339507</k>
  <c>268033</c>
  <p>339494</p>
  <h>false</h>
  <hasPrv>false</hasPrv>
  <ic>false</ic>
  <trackElementDependents>false</trackElementDependents>
  <isPermanent>true</isPermanent>
  <isTemp>false</isTemp>
  </algorithm>
  </externalTransformation>
  </it>
  </its>
  </tArg>
  </UpdateDataAreaExternalTransformations>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
  <UpdateDataAreaExternalTransformationsResult 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</UpdateDataAreaExternalTransformationsResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"UpdateDataAreaExternalTransformations" :
{
"mon" : "FPJHEGEAILDDGOAEBNPJEFNNPNNPCPAELKNIOBNJKIPKLKBE!M!S!PDFCFFHEAILDDGOAECGFLOGBJGLOFCJHEFKJBCNDOFDGMOMON!DataArea!DataSources!1!DataSourceSlices!1!ExternalTransformations",
"tArg" :
{
"its" :
{
"it" :
[
{
"action" :
{
"operation" : "Add"
},
"externalTransformation" :
{
"k" : "-1",
"enabled" : "true",
"saveDataOption" : "false",
"calculationPeriodMode" : "0",
"calculationMode" : "1",
"algorithm" :
{
"@ds" : "",
"@isShortcut" : "false",
"@isLink" : "false",
"@ver" : "4",
"@hf" : "false",
"i" : "OBJ339507",
"n" : "Calculation algorithm",
"k" : "339507",
"c" : "268033",
"p" : "339494",
"h" : "false",
"hasPrv" : "false",
"ic" : "false",
"trackElementDependents" : "false",
"isPermanent" : "true",
"isTemp" : "false"
}
}
}
]
}
}
}
}

JSON response:

{
"UpdateDataAreaExternalTransformationsResult" : "1"
}
public static bool AddAlgorithmForSlice(string moniker, uint sourceKey, uint sliceKey, Ob newAlg)
{
var somClient = new SomPortTypeClient(); // Proxy object for operation execution
// Operation execution parameters
var tUpd = new UpdateDataAreaExternalTransformations()
{
tArg = new DataAreaExternalTransformationUpdateActions()
{
its = new DataAreaExternalTransformationUpdateAction[]
{
new DataAreaExternalTransformationUpdateAction()
{
action = new DataAreaExternalTransformationUpdateActionType() { operation = DataAreaExternalTransformationUpdateActionOperation.Add },
externalTransformation = new DataAreaExternalTransformation()
{
k = uint.MaxValue,
enabled = true,
algorithm = newAlg,
calculationMode = 1, // To change data
calculationPeriodMode = 0, // Intersection of algorithm and slice selections
saveDataOption = false // Do not save data
}
}
}
},
mon = moniker + "!DataArea!DataSources!" + sourceKey + "!DataSourceSlices!" + sliceKey + "!ExternalTransformations"
};
// Add calculation algorithm for data slice
var result = somClient.UpdateDataAreaExternalTransformations(tUpd);
return result;
}

See also:

UpdateDataAreaExternalTransformations: Operation