Deleting Equation

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.

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">
<GetMs xmlns="http://www.prognoz.ru/PP.SOM.Som">
<tMs xmlns="">
  <id>CEOHFIGABHNBFOAEACLDIHAAFIBLHLNEJJHHIHEGOIMCAOGA!M!S!CPOKJBJGABHNBFOAEFABNMBGBLLNHOPAEHKDKCJFDLLMFBFKJ</id>
  </tMs>
<tArg xmlns="">
<pattern>
  <obInst>true</obInst>
  <scenarios>Get</scenarios>
<item>
  <key>92145</key>
<problem>
<metamodel>
  <calculationChain>Get</calculationChain>
  <mmParams>Get</mmParams>
  <tag>true</tag>
<calcChainPattern>
<modelPattern>
<transform>
<transformVariable>
  <slices>Get</slices>
<transformSlice>
  <selection>Get</selection>
  </transformSlice>
  </transformVariable>
  </transform>
  </modelPattern>
  </calcChainPattern>
<visualControllerPattern>
  <variableRubricatorKey>true</variableRubricatorKey>
  <useSourceName>false</useSourceName>
  <levelFormat>Short</levelFormat>
  </visualControllerPattern>
  </metamodel>
  <scenarios>Get</scenarios>
  <details>true</details>
  <useSavedCoefficients>true</useSavedCoefficients>
  </problem>
  </item>
  </pattern>
<execParams>
<modelKeys>
  <l>3</l>
  </modelKeys>
  <execRemoveModel>true</execRemoveModel>
  </execParams>
  </tArg>
  </GetMs>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<GetMsResult xmlns="http://www.prognoz.ru/PP.SOM.Som" xmlns:q1="http://www.prognoz.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id xmlns="">
  <id>CEOHFIGABHNBFOAEACLDIHAAFIBLHLNEJJHHIHEGOIMCAOGA!M!S!CPOKJBJGABHNBFOAEFABNMBGBLLNHOPAEHKDKCJFDLLMFBFKJ</id>
  </id>
<meta xmlns="">
<obInst>
<obDesc isShortcut="0" isLink="0" fullUrl="http://v-shp-development.dev.fs.fsight.world/" ver="6" hf="0">
  <i>MODELSPACE</i>
  <n>Modeling container</n>
  <k>1581</k>
  <c>5121</c>
  <p>1580</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  <isPermanent>1</isPermanent>
  <isTemp>0</isTemp>
  </obDesc>
  </obInst>
  <dirty>0</dirty>
<scenarios>
<nodes>
<it isFolder="0">
  <k>1628</k>
  <id>OBJ1628</id>
  <n>Base</n>
  <vis>1</vis>
<scenDesc isShortcut="0" isLink="0" fullUrl="http://v-shp-development.dev.fs.fsight.world/" ver="0" hf="0">
  <i>OBJ1628</i>
  <n>Base</n>
  <k>1628</k>
  <c>5124</c>
  <p>1627</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  </scenDesc>
  <internalKey>1629</internalKey>
  </it>
<it isFolder="0">
  <k>5371</k>
  <id>OBJ5371</id>
  <n>Base (copy1)</n>
  <vis>1</vis>
<scenDesc isShortcut="0" isLink="0" fullUrl="http://v-shp-development.dev.fs.fsight.world/" ver="0" hf="0">
  <i>OBJ5371</i>
  <n>Base (copy1)</n>
  <k>5371</k>
  <c>5124</c>
  <p>1627</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  </scenDesc>
  <internalKey>5372</internalKey>
  </it>
  </nodes>
  </scenarios>
<item>
  <k>92145</k>
  <id>MODEL_DEL</id>
  <n>MODEL_DEL</n>
  <vis>1</vis>
  <type>Problem</type>
<problemMd>
<metamodel>
  <k>92146</k>
<calculationChain>
<its>
<Item>
  <k>1</k>
  <n>Modeling variable 1</n>
  <vis>1</vis>
  <type>Variable</type>
  <excluded>0</excluded>
  <graphMeta>{"Geometry":{"x":10,"y":10,"width":150,"height":50}}</graphMeta>
<chainVariable>
<slice>
  <k>0</k>
  <id>Modeling variable 1|A</id>
  <n>Modeling variable 1|A</n>
  <vis>1</vis>
  <variableKey>1</variableKey>
  <stubKey>92147</stubKey>
<selections>
<its>
<Item>
<id>
  <id>92159</id>
  </id>
  <variant>1</variant>
  </Item>
  </its>
  </selections>
  <aggregator>None</aggregator>
<parametrizedDimensions>
<its>
<Item>
  <dimension>0</dimension>
  <parameter>0</parameter>
  </Item>
  </its>
  </parametrizedDimensions>
<unitInfo>
  <unit>4294967295</unit>
  <measure>4294967295</measure>
  <baseUnit>4294967295</baseUnit>
  <unitsDimensionKey>0</unitsDimensionKey>
  </unitInfo>
  <level>Year</level>
  </slice>
  <fullName>Modeling variable 1|A</fullName>
  <originalName>Modeling variable 1</originalName>
  <originalShortName>Modeling variable 1</originalShortName>
  <useCustomName>0</useCustomName>
  </chainVariable>
  </Item>
<Item>
  <k>3</k>
  <n>Modeling variable 2</n>
  <vis>1</vis>
  <type>Variable</type>
  <excluded>0</excluded>
  <graphMeta>{"Geometry":{"x":10,"y":70,"width":150,"height":50}}</graphMeta>
<chainVariable>
<slice>
  <k>0</k>
  <id>Modeling variable 2|A</id>
  <n>Modeling variable 2|A</n>
  <vis>1</vis>
  <variableKey>2</variableKey>
  <stubKey>92147</stubKey>
<selections>
<its>
<Item>
<id>
  <id>92159</id>
  </id>
  <variant>2</variant>
  </Item>
  </its>
  </selections>
  <aggregator>None</aggregator>
<parametrizedDimensions>
<its>
<Item>
  <dimension>0</dimension>
  <parameter>0</parameter>
  </Item>
  </its>
  </parametrizedDimensions>
<unitInfo>
  <unit>4294967295</unit>
  <measure>4294967295</measure>
  <baseUnit>4294967295</baseUnit>
  <unitsDimensionKey>0</unitsDimensionKey>
  </unitInfo>
  <level>Year</level>
  </slice>
  <fullName>Modeling variable 2|A</fullName>
  <originalName>Modeling variable 2</originalName>
  <originalShortName>Modeling variable 2</originalShortName>
  <useCustomName>0</useCustomName>
  </chainVariable>
  </Item>
  </its>
  </calculationChain>
<mmParams>
  <its />
  </mmParams>
<visualController>
  <variableRubricatorKey>92147</variableRubricatorKey>
  <userRPath />
  <isRExist>0</isRExist>
  </visualController>
<suppressEmptyFilter>
  <suppressEmpty>0</suppressEmpty>
  <suppressEmptyArea>SerieBounds</suppressEmptyArea>
  </suppressEmptyFilter>
  <readOnly>0</readOnly>
  <variableTestUseR>0</variableTestUseR>
  <calculateIdentOnFact>0</calculateIdentOnFact>
  </metamodel>
<scenarios>
  <its />
  </scenarios>
<details>
<period>
  <identificationStartDate>1969-01-01</identificationStartDate>
  <identificationEndDate>2018-05-23</identificationEndDate>
  <forecastStartDate>2018-05-24</forecastStartDate>
  <forecastEndDate>2020-12-31</forecastEndDate>
  <identificationStartDateParamID />
  <identificationEndDateParamID />
  <forecastStartDateParamID />
  <forecastEndDateParamID />
  <autoPeriod>0</autoPeriod>
  <identificationStartOffset>0</identificationStartOffset>
  <identificationEndOffset>0</identificationEndOffset>
  <forecastEndOffset>0</forecastEndOffset>
  <isIdentStartCorrect>1</isIdentStartCorrect>
  <isIdentEndCorrect>1</isIdentEndCorrect>
  <isForecastEndCorrect>1</isForecastEndCorrect>
  </period>
  <currentPoint>2018-05-24</currentPoint>
  </details>
  <useSavedCoefficients>0</useSavedCoefficients>
  <useScenarios>0</useScenarios>
  <readOnly>0</readOnly>
  </problemMd>
  </item>
  </meta>
  </GetMsResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
 "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"
      }
    }
  }
}

JSON response:

{
 "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"
        }
      }
    }
  }
}
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:

GetMs: Operation