SetAlgResult SetAlg(AlgId tAlg, SetAlgArg tArg)
tAlg. Moniker of indicators calculation algorithm instance or its block instance.
tArg. Operation execution parameters.
The SetAlg operation changes indicators calculation algorithm metadata or its blocks metadata.
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.
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.
{
"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"
}
}
}
}
{
"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: