Saving a Calculated Series as Modeling Problem

Below is the example of using the GetWbkMd operation to save a calculated series as a modeling problem. The request contains an instance of opened workbook and a pattern for saving the modeling problem. The response contains description of the created problem.

IMPORTANT. Before saving a calculated series as a modeling problem, determine values of all the mandatory attributes for this series.

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">
<GetWbkMd xmlns="http://www.fsight.ru/PP.SOM.Som">
<tWbk xmlns="">
  <id>S1!M!S!W7</id>
  </tWbk>
<tArg xmlns="">
<pattern>
  <obInst>true</obInst>
  <useGridAutoAdjust>true</useGridAutoAdjust>
<action>
<saveAsProblem>
<createInfo>
  <name>Modeling problem</name>
  <id />
  <permanent>true</permanent>
  </createInfo>
  <series />
  </saveAsProblem>
  </action>
  </pattern>
  </tArg>
  </GetWbkMd>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<GetWbkMdResult 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!W7</id>
  </id>
<meta xmlns="">
<obInst>
<obDesc ds="" isShortcut="0" isLink="0" ver="2" hf="0">
  <i>WBK_CALC</i>
  <n>Calculated series</n>
  <k>5541</k>
  <c>2827</c>
  <p>5471</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  <trackElementDependents>0</trackElementDependents>
  <isPermanent>1</isPermanent>
  <isTemp>0</isTemp>
  </obDesc>
  </obInst>
  <dirty>1</dirty>
  <windowsPosition>Vertical</windowsPosition>
  <hasPivot>0</hasPivot>
  <hasLaner>1</hasLaner>
<series count="4">
  <its />
  </series>
<action>
<saveAsProblem>
<object ds="" isShortcut="0" isLink="0" ver="1" hf="0">
  <i>OBJ219714</i>
  <n>Modeling problem</n>
  <k>219714</k>
  <c>5123</c>
  <p>5474</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  <trackElementDependents>0</trackElementDependents>
<obId>
  <id />
  </obId>
  </object>
  </saveAsProblem>
  </action>
  </meta>
  </GetWbkMdResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"GetWbkMd" :
{
"tWbk" :
{
"id" : "S1!M!S!W7"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"useGridAutoAdjust" : "true",
"action" :
{
"saveAsProblem" :
{
"createInfo" :
{
"name" : "Modeling problem",
"id" : "",
"permanent" : "true"
},
"series" : ""
}
}
}
}
}
}

JSON response:

{
"GetWbkMdResult" :
{
"id" :
{
"id" : "S1!M!S!W7"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "2",
"@hf" : "0",
"i" : "WBK_CALC",
"n" : "Calculated series",
"k" : "5541",
"c" : "2827",
"p" : "5471",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0",
"isPermanent" : "1",
"isTemp" : "0"
}
},
"dirty" : "1",
"windowsPosition" : "Vertical",
"hasPivot" : "0",
"hasLaner" : "1",
"series" :
{
"@count" : "4",
"its" : ""
},
"action" :
{
"saveAsProblem" :
{
"object" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "1",
"@hf" : "0",
"i" : "OBJ219714",
"n" : "Modeling problem",
"k" : "219714",
"c" : "5123",
"p" : "5474",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0",
"obId" :
{
"id" : ""
}
}
}
}
}
}
}
public static WbkSaveAsProblemResult GetWbkSaveAsProblem(WbkId wbk, ItKey[] series)
{// Set operation execution parameters
var tOp = new GetWbkMd
{
tWbk = wbk,
tArg = new GetWbkMdArg
{// Set pattern for getting data
pattern = new WbkMdPattern
{
action = new WbkActionArg()
{
saveAsProblem = new WbkSaveAsProblemArg()
{
createInfo = new ObjectCreateBaseInfo()
{
id = "",
name = "Modeling problem",
permanent = true
},
series = series
}
}
}
}
};
// Create proxy object for operation execution
var somClient = new SomPortTypeClient();
// Execute operation
var gRes = somClient.GetWbkMd(tOp);
WbkActionResult actRes = gRes.meta.action;
WbkSaveAsProblemResult saveProblRes = actRes.saveAsProblem;
Console.WriteLine("Identifier of created problem: " + saveProblRes.@object.i);
return saveProblRes;
}

See also:

GetWbkMd: Operation