Below is the example of using the GetMs operation to delete an equation. The request contains an instance of opened modeling container, operation execution parameters, and the pattern for getting changed data. After execution the operation returns the model without equation.
{ "GetMs" : { "tMs" : { "id" : "CEOHFIGABHNBFOAEACLDIHAAFIBLHLNEJJHHIHEGOIMCAOGA!M!S!CPOKJBJGABHNBFOAEFABNMBGBLLNHOPAEHKDKCJFDLLMFBFKJ" }, "tArg" : { "pattern" : { "obInst" : "true", "scenarios" : "Get", "item" : { "key" : "92145", "problem" : { "metamodel" : { "calculationChain" : "Get", "mmParams" : "Get", "tag" : "true", "calcChainPattern" : { "modelPattern" : { "transform" : { "transformVariable" : { "slices" : "Get", "transformSlice" : { "selection" : "Get" } } } } }, "visualControllerPattern" : { "variableRubricatorKey" : "true", "useSourceName" : "false", "levelFormat" : "Short" } }, "scenarios" : "Get", "details" : "true", "useSavedCoefficients" : "true" } } }, "execParams" : { "modelKeys" : { "l" : "3" }, "execRemoveModel" : "true" } } } }
{ "GetMsResult" : { "id" : { "id" : "CEOHFIGABHNBFOAEACLDIHAAFIBLHLNEJJHHIHEGOIMCAOGA!M!S!CPOKJBJGABHNBFOAEFABNMBGBLLNHOPAEHKDKCJFDLLMFBFKJ" }, "meta" : { "obInst" : { "obDesc" : { "@fullUrl" : "http:\/\/v-shp-development.dev.fs.fsight.world\/", "@isShortcut" : "0", "@isLink" : "0", "@ver" : "6", "@hf" : "0", "i" : "MODELSPACE", "n" : "Modeling container", "k" : "1581", "c" : "5121", "p" : "1580", "h" : "0", "hasPrv" : "0", "ic" : "0", "isPermanent" : "1", "isTemp" : "0" } }, "dirty" : "0", "scenarios" : { "nodes" : { "it" : [ { "@isFolder" : "0", "k" : "1628", "id" : "OBJ1628", "n" : "Basic", "vis" : "1", "scenDesc" : { "@fullUrl" : "http:\/\/v-shp-development.dev.fs.fsight.world\/", "@isShortcut" : "0", "@isLink" : "0", "@ver" : "0", "@hf" : "0", "i" : "OBJ1628", "n" : "Basic", "k" : "1628", "c" : "5124", "p" : "1627", "h" : "0", "hasPrv" : "0", "ic" : "0" }, "internalKey" : "1629" }, { "@isFolder" : "0", "k" : "5371", "id" : "OBJ5371", "n" : "Basic (copy1)", "vis" : "1", "scenDesc" : { "@fullUrl" : "http:\/\/v-shp-development.dev.fs.fsight.world\/", "@isShortcut" : "0", "@isLink" : "0", "@ver" : "0", "@hf" : "0", "i" : "OBJ5371", "n" : "Basic (copy1)", "k" : "5371", "c" : "5124", "p" : "1627", "h" : "0", "hasPrv" : "0", "ic" : "0" }, "internalKey" : "5372" } ] } }, "item" : { "k" : "92145", "id" : "MODEL_DEL", "n" : "MODEL_DEL", "vis" : "1", "type" : "Problem", "problemMd" : { "metamodel" : { "k" : "92146", "calculationChain" : { "its" : { "Item" : [ { "k" : "1", "n" : "Modeling variable 1", "vis" : "1", "type" : "Variable", "excluded" : "0", "graphMeta" : "{"Geometry":{"x":10,"y":10,"width":150,"height":50}}", "chainVariable" : { "slice" : { "k" : "0", "id" : "Modeling variable 1|A", "n" : "Modeling variable 1|A", "vis" : "1", "variableKey" : "1", "stubKey" : "92147", "selections" : { "its" : { "Item" : { "id" : { "id" : "92159" }, "variant" : "1" } } }, "aggregator" : "None", "parametrizedDimensions" : { "its" : { "Item" : { "dimension" : "0", "parameter" : "0" } } }, "unitInfo" : { "unit" : "4294967295", "measure" : "4294967295", "baseUnit" : "4294967295", "unitsDimensionKey" : "0" }, "level" : "Year" }, "fullName" : "Modeling variable 1|A", "originalName" : "Modeling variable 1", "originalShortName" : "Modeling variable 1", "useCustomName" : "0" } }, { "k" : "3", "n" : "Modeling variable 2", "vis" : "1", "type" : "Variable", "excluded" : "0", "graphMeta" : "{"Geometry":{"x":10,"y":70,"width":150,"height":50}}", "chainVariable" : { "slice" : { "k" : "0", "id" : "Modeling variable 2|A", "n" : "Modeling variable 2|A", "vis" : "1", "variableKey" : "2", "stubKey" : "92147", "selections" : { "its" : { "Item" : { "id" : { "id" : "92159" }, "variant" : "2" } } }, "aggregator" : "None", "parametrizedDimensions" : { "its" : { "Item" : { "dimension" : "0", "parameter" : "0" } } }, "unitInfo" : { "unit" : "4294967295", "measure" : "4294967295", "baseUnit" : "4294967295", "unitsDimensionKey" : "0" }, "level" : "Year" }, "fullName" : "Modeling variable 2|A", "originalName" : "Modeling variable 2", "originalShortName" : "Modeling variable 2", "useCustomName" : "0" } } ] } }, "mmParams" : { "its" : "" }, "visualController" : { "variableRubricatorKey" : "92147", "userRPath" : "", "isRExist" : "0" }, "suppressEmptyFilter" : { "suppressEmpty" : "0", "suppressEmptyArea" : "SerieBounds" }, "readOnly" : "0", "variableTestUseR" : "0", "calculateIdentOnFact" : "0" }, "scenarios" : { "its" : "" }, "details" : { "period" : { "identificationStartDate" : "1969-01-01", "identificationEndDate" : "2018-05-23", "forecastStartDate" : "2018-05-24", "forecastEndDate" : "2020-12-31", "identificationStartDateParamID" : "", "identificationEndDateParamID" : "", "forecastStartDateParamID" : "", "forecastEndDateParamID" : "", "autoPeriod" : "0", "identificationStartOffset" : "0", "identificationEndOffset" : "0", "forecastEndOffset" : "0", "isIdentStartCorrect" : "1", "isIdentEndCorrect" : "1", "isForecastEndCorrect" : "1" }, "currentPoint" : "2018-05-24" }, "useSavedCoefficients" : "0", "useScenarios" : "0", "readOnly" : "0" } } } } }
The GetMsDelEq function deletes the specified equation from the model. Input parameters:
ms. Opened modeling container instance.
modelKey. Key of the model that contains the equation.
eqKey. Key of opened equation.
After execution the function returns the model without equation.
public static MsItem GetMsDelEq(MsId ms, ulong modelKey, long eqKey) { var getMsOp = new GetMs(); getMsOp.tMs = ms; getMsOp.tArg = new GetMsArg() { // Set data change pattern pattern = new MsMdPattern() { item = new MsItemPattern() { key = modelKey, problem = new MsProblemPattern() { details = true, scenarios = ListOperation.Get, useSavedCoefficients = true, metamodel = new MsMetaModelPattern() { tag = true, calculationChain = ListOperation.Get, mmParams = ListOperation.Get, calcChainPattern = new MsCalculationChainPattern() { modelPattern = new MsModelPattern() { transform = new MsFormulaTransformPattern() { transformVariable = new MsFormulaTransformVariablePattern() { slices = ListOperation.Get, transformSlice = new MsFormulaTransformSlicePattern() { selection = ListOperation.Get } } } } }, visualControllerPattern = new MsMetaModelVisualControllerPattern() { levelFormat = MsLevelFormat.Short, useSourceName = false, variableRubricatorKey = true } } } }, scenarios = ListOperation.Get }, execParams = new MsMdExecParams() { modelKeys = new long[] { eqKey }, execRemoveModel = true } }; // Create a proxy object for operation execution var somClient = new SomPortTypeClient(); // Set operation execution parameters var result = somClient.GetMs(getMsOp); return result.meta.item; }
See also: