Below is the example of using the GetMs operation to create an object that calculates a model. The request contains an instance of opened modeling container, pattern and parameters of model calculation. The response contains calculation parameters.
{
"Envelope" :
{
"Body" :
{
"GetMs" :
{
"tMs" :
{
"id" : "S30!M!S!C1"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"item" :
{
"key" : "2803",
"problem" :
{
"calculation" :
{
"calculationState" : ""
}
}
}
},
"execParams" :
{
"calculationSettings" :
{
"includedScenarioKeys" : "",
"factIncluded" : "true",
"paramValues" :
{
"its" :
{
"Item" :
{
"k" : "0",
"id" : "ITEM1",
"value" : "5"
}
}
},
"period" :
{
"identificationStartDate" : "1990-01-01",
"identificationEndDate" : "2005-01-01",
"forecastStartDate" : "2006-01-01",
"forecastEndDate" : "2015-01-01"
},
"dataLoadingPeriod" :
{
"useDefault" : "false",
"startDate" : "1990-01-01",
"endDate" : "2006-01-01"
},
"defaultLevel" : "Year",
"breakOnError" : "true",
"clearSeriesOnWarning" : "true", "filterWarnings" : "true" }, "execSaveProblem" : "true", "execCalculate" : "true" } } } } } }
{
"Envelope" :
{
"Body" :
{
"GetMsResult" :
{
"id" :
{
"id" : "S30!M!S!C1"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@isShortcut" : "0",
"i" : "MODELSPACE",
"n" : "Modeling container",
"k" : "1581",
"c" : "5121",
"p" : "1580",
"h" : "0"
}
},
"dirty" : "0",
"item" :
{
"k" : "2803",
"id" : "TEMP_MODEL",
"n" : "TEMP_MODEL",
"vis" : "1",
"type" : "Problem",
"problemMd" :
{
"calculation" :
{
"pointCount" : "0",
"pointPassed" : "0",
"saveData" : "1",
"copyFact" : "0",
"treatNullsAsZeros" : "0",
"isRunning" : "0",
"calculationState" :
{
"scenarioKey" : "4294967295",
"currentPoint" : "1899-12-30",
"message" : ""
}, "isSuspend" : "0" }, "problemCalculationKey" : "0" } } } } } } }
The GetMsStartCalc function creates an object to calculate the specified model. Input parameters:
ms. Opened modeling container instance.
modelKey. Key of the calculated model.
After execution the function returns key of the object that calculates a model.
public static ulong? GetMsStartCalc(MsId ms, ulong modelKey)
{
var getMsOp = new GetMs();
// Set operation execution parameters
getMsOp.tMs = ms;
getMsOp.tArg = new GetMsArg()
{ // Set general data extraction pattern
pattern = new MsMdPattern()
{
item = new MsItemPattern()
{ // Set calculated model key
key = modelKey,
problem = new MsProblemPattern()
{ // Set data calculation pattern
calculation = new MsProblemCalculationPattern()
{
calculationState = new MsCalculationStatePattern(){}
}
}
}
},
execParams = new MsMdExecParams()
{ // Set calculation parameters
calculationSettings = new MsProblemCalculationSettings()
{
includedScenarioKeys = new long[] { },
factIncluded = true
// Set metamodel parameter values
paramValues = new MsModelParamValues()
{
its = new MsModelParamValue[]
{
new MsModelParamValue()
{
id = "ITEM1",
value = "5"
}
}
},// Set calculation periods
period = new MsModelPeriod()
{
identificationStartDate = DateTime.Parse("01.01.1990"),
identificationEndDate = DateTime.Parse("01.01.2005"),
forecastStartDate = DateTime.Parse("01.01.2006"),
forecastEndDate = DateTime.Parse("01.01.2015")
}, // Set data loading periods
dataLoadingPeriod = new MsDataLoadingPeriod()
{
useDefault = false,
startDate = DateTime.Parse("01.01.1990"),
endDate = DateTime.Parse("01.01.2006")
},// Set calendar frequency and other parameters
defaultLevel = DimCalendarLvl.Year,
breakOnError = true,
clearSeriesOnWarning = true,
filterWarnings = true
}
execCalculate = true, execSaveProblem = true } }; // Create proxy object for operation execution var somClient = new SomPortTypeClient(); // Start calculation GetMsResult getMsResult = somClient.GetMs(getMsOp); ulong? prCalcKey = getMsResult.meta.item.problemMd.problemCalculationKey; return prCalcKey; }
See also:
SOAP