SetAlg

Syntax

SetAlgResult SetAlg(AlgId tAlg, SetAlgArg tArg)

Parameters

tAlg. Moniker of indicators calculation algorithm instance or its block instance.

tArg. Operation execution parameters.

Description

The SetAlg operation changes indicators calculation algorithm metadata or its blocks metadata.

Comments

This operation changes settings of calculation block, calculation algorithm, or function block. To execute the operation, in the tAlg field specify object instance moniker, and in the tArg field specify the parameters, according to which object are changed. The moniker can be obtained on executing the OpenAlg operation. In the tArg.pattern field specify the pattern that will be used to make changed, and in the tArg.meta field specify updated metadata.

After making changes to save the object, use the SaveAlg operation.

The operation results in the updated metadata if the tArg.metaGet field was also defined on executing the operation.

Example

Below is the example of creating a new calculation algorithm parameter. The request contains calculation algorithm instance moniker, the pattern that determines whether a new parameter should be created, and metadata with parameter basic properties. The response contains updated information about calculation algorithm parameters.

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">
<SetAlg xmlns="http://www.fsight.ru/PP.SOM.Som">
<tAlg xmlns="">
  <id>S1!M!S!C1</id>
  </tAlg>
<tArg xmlns="">
<pattern>
  <obInst>true</obInst>
  <params>Add</params>
  </pattern>
<meta>
<calcObject>
  <k>0</k>
<params>
<its>
<it>
  <k>-1</k>
  <id>START_PARAM</id>
  <n>New parameter</n>
  </it>
  </its>
  </params>
  </calcObject>
  </meta>
<metaGet>
  <obInst>true</obInst>
  <params>Get</params>
  </metaGet>
  </tArg>
  </SetAlg>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<SetAlgResult 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">
<id xmlns="">
  <id>S1!M!S!C1</id>
  </id>
<meta xmlns="">
<obInst>
<obDesc ds="" isShortcut="0" isLink="0" ver="40" hf="0">
  <i>AREA_ALG</i>
  <n>Algorithm for calculating data area indicators</n>
  <k>231264</k>
  <c>268033</c>
  <p>231226</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  <trackElementDependents>0</trackElementDependents>
  <isPermanent>1</isPermanent>
  <isTemp>0</isTemp>
  </obDesc>
  </obInst>
  <dirty>0</dirty>
<calcObject>
  <k>231264</k>
  <id>AREA_ALG</id>
  <n>Algorithm for calculating data area indicators</n>
  <vis>1</vis>
  <type>Algorithm</type>
<params>
<its>
<it>
  <k>1</k>
  <id>PARAM0</id>
  <n>Period</n>
  <vis>1</vis>
  <dataType>2</dataType>
  <defaultValueSelection>S1!M!S!S6</defaultValueSelection>
  <linkedObjectKey>104891</linkedObjectKey>
  <linkedStubKey>-1</linkedStubKey>
  <hidden>0</hidden>
  <tag />
<attrs>
<its>
<it>
  <k>1</k>
  <id>BLOCK_TYPE</id>
  <n>Calendar block type</n>
  <vis>1</vis>
  <dt>2</dt>
  </it>
<it>
  <k>2</k>
  <id>START_DATE</id>
  <n>Period start date</n>
  <vis>1</vis>
  <dt>4</dt>
  </it>
<it>
  <k>3</k>
  <id>NAME</id>
  <n>Calendar element name</n>
  <vis>1</vis>
  <dt>1</dt>
  </it>
<it>
  <k>4</k>
  <id>ID</id>
  <n>Identifier</n>
  <vis>1</vis>
  <dt>1</dt>
  </it>
<it>
  <k>5</k>
  <id>ORDER</id>
  <n>Order</n>
  <vis>1</vis>
  <dt>2</dt>
  </it>
<it>
  <k>6</k>
  <id>PERIOD</id>
  <n>Period</n>
  <vis>1</vis>
  <dt>4</dt>
  </it>
<it>
  <k>7</k>
  <id>YEAR</id>
  <n>Year number</n>
  <vis>1</vis>
  <dt>2</dt>
  </it>
<it>
  <k>8</k>
  <id>HALF_OF_YEAR</id>
  <n>Half-year number</n>
  <vis>1</vis>
  <dt>2</dt>
  </it>
<it>
  <k>9</k>
  <id>QUARTER</id>
  <n>Quarter number</n>
  <vis>1</vis>
  <dt>2</dt>
  </it>
<it>
  <k>10</k>
  <id>MONTH</id>
  <n>Month number</n>
  <vis>1</vis>
  <dt>2</dt>
  </it>
  </its>
  </attrs>
  <index>0</index>
  </it>
<it>
  <k>2</k>
  <id>START_PARAM</id>
  <n>New parameter</n>
  <vis>1</vis>
  <dataType>2</dataType>
  <defaultValue />
  <linkedStubKey>-1</linkedStubKey>
  <hidden>0</hidden>
  <tag />
  <index>1</index>
  </it>
  </its>
  </params>
  <paramsValidationMessage>The New Parameter (START_PARAM) parameter does not have link to dictionary</paramsValidationMessage>
<algorithm>
  <workspace>S1!M!S!C1!W</workspace>
  </algorithm>
  </calcObject>
  </meta>
  </SetAlgResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"SetAlg" :
{
"tAlg" :
{
"id" : "S1!M!S!C1"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"params" : "Add"
},
"meta" :
{
"calcObject" :
{
"k" : "0",
"params" :
{
"its" :
{
"it" :
[
{
"k" : "-1",
"id" : "START_PARAM",
"n" : "New parameter"
}
]
}
}
}
},
"metaGet" :
{
"obInst" : "true",
"params" : "Get"
}
}
}
}

JSON response:

{
"SetAlgResult" :
{
"id" :
{
"id" : "S1!M!S!C1"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "40",
"@hf" : "0",
"i" : "AREA_ALG",
"n" : "Algorithm for calculating data area indicators",
"k" : "231264",
"c" : "268033",
"p" : "231226",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0",
"isPermanent" : "1",
"isTemp" : "0"
}
},
"dirty" : "0",
"calcObject" :
{
"k" : "231264",
"id" : "AREA_ALG",
"n" : "Algorithm for calculating data area indicators",
"vis" : "1",
"type" : "Algorithm",
"params" :
{
"its" :
{
"it" :
[
{
"k" : "1",
"id" : "PARAM0",
"n" : "Period",
"vis" : "1",
"dataType" : "2",
"defaultValueSelection" : "S1!M!S!S6",
"linkedObjectKey" : "104891",
"linkedStubKey" : "-1",
"hidden" : "0",
"tag" : "",
"attrs" :
{
"its" :
{
"it" :
[
{
"k" : "1",
"id" : "BLOCK_TYPE",
"n" : "Calendar block type",
"vis" : "1",
"dt" : "2"
},
{
"k" : "2",
"id" : "START_DATE",
"n" : "Period start date",
"vis" : "1",
"dt" : "4"
},
{
"k" : "3",
"id" : "NAME",
"n" : "Calendar element name",
"vis" : "1",
"dt" : "1"
},
{
"k" : "4",
"id" : "ID",
"n" : "Identifier",
"vis" : "1",
"dt" : "1"
},
{
"k" : "5",
"id" : "ORDER",
"n" : "Order",
"vis" : "1",
"dt" : "2"
},
{
"k" : "6",
"id" : "PERIOD",
"n" : "Period",
"vis" : "1",
"dt" : "4"
},
{
"k" : "7",
"id" : "YEAR",
"n" : "Year number",
"vis" : "1",
"dt" : "2"
},
{
"k" : "8",
"id" : "HALF_OF_YEAR",
"n" : "Half-year number",
"vis" : "1",
"dt" : "2"
},
{
"k" : "9",
"id" : "QUARTER",
"n" : "Quarter number",
"vis" : "1",
"dt" : "2"
},
{
"k" : "10",
"id" : "MONTH",
"n" : "Month number",
"vis" : "1",
"dt" : "2"
}
]
}
},
"index" : "0"
},
{
"k" : "2",
"id" : "START_PARAM",
"n" : "New parameter",
"vis" : "1",
"dataType" : "2",
"defaultValue" : "",
"linkedStubKey" : "-1",
"hidden" : "0",
"tag" : "",
"index" : "1"
}
]
}
},
"paramsValidationMessage" : "The New Parameter (START_PARAM) parameter does not have link to dictionary",
"algorithm" :
{
"workspace" : "S1!M!S!C1!W"
}
}
}
}
}
public static SetAlgResult AlgoAddParam(string moniker)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSet = new SetAlg()
{
tArg = new SetAlgArg()
{
pattern = new AlgMdPattern()
{
@params = ListOperation.Add
},
meta = new AlgMd()
{
calcObject = new AlgCalcObject()
{
@params = new MsModelParams()
{
its = new MsModelParam[1]
{
new MsModelParam()
{
k = uint.MaxValue,
n = "New parameter",
id = "START_PARAM"
}
}
}
}
},
metaGet = new AlgMdPattern()
{
@params = ListOperation.Get
}
},
tAlg = new AlgId() { id = moniker }
};
//Change metadata
var result = somClient.SetAlg(tSet);
return result;
}

See also:

Working with Indicators Calculation Algorithm