Below is the example of using the GetMs operation to get model data. The request contains an instance of opened modeling container and the data getting pattern. The response contains the workbook that contains model data.
{ "Envelope" : { "Body" : { "GetMs" : { "tMs" : { "id" : "S65!M!S!C1" }, "tArg" : {
"pattern" : { "obInst" : "true", "item" : { "key" : "2803", "problem" : { "metamodel" : {
"visualControllerPattern" : { "chainWorkbook" : { "pattern" : { "obInst" : "true", "cellsTable" : { "headers" : "true",
"slots" : { "elementName" : "true" }, "cells" : "true", "emptyCells" : "false", "getCellDate" : "true" } } },
"chainWorkbookEax" : { "pattern" : { "obInst" : "true", "dataEditState" : "true", "dataSource" : "", "gridStyle" : { "all" : "false",
"parts" : { "it" : "Table" } } } } } } }
} }, "execParams" : { "execFillChain" : "true" } } } } } }
{ "Envelope" : { "Body" : { "GetMsResult" : { "id" : {
"id" : "S65!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" : { "metamodel" : { "k" : "2804",
"visualController" : { "chainWorkbook" : { "id" : { "id" : "S65!M!S!W3" }, "meta" : {
"obInst" : { "obDesc" : { "@isShortcut" : "0", "i" : "CHAINWB_2804", "n" : "ChainWorkBook", "k" : "2837", "c" : "2827", "p" : "2804",
"h" : "0" } }, "dirty" : "1", "windowsPosition" : "Vertical", "hasPivot" : "0", "hasLaner" : "1", "series" : { "@count" : "2",
"its" : "" }, "cellsTable" : { "@rowCount" : "2", "@columnCount" : "31", "columns" : { "dims" : {
"it" : { "k" : "0", "id" : "calendar" } }, "slots" : { "s" : [
{ "@date" : "1990-01-01", "els" : { "e" : { "k" : "YEARS:1.1.1990", "n" : "1990A1" } }
}, { "@date" : "1991-01-01", "els" : { "e" : { "k" : "YEARS:1.1.1991", "n" : "1991A1" }
} }, { "@date" : "1992-01-01", "els" : { "e" : { "k" : "YEARS:1.1.1992", "n" : "1992A1"
} } }, { "@date" : "1993-01-01", "els" : { "e" : { "k" : "YEARS:1.1.1993",
"n" : "1993A1" } } }, { "@date" : "1994-01-01", "els" : { "e" : {
"k" : "YEARS:1.1.1994", "n" : "1994A1" } } }, { "@date" : "1995-01-01", "els" : { "e" :
{ "k" : "YEARS:1.1.1995", "n" : "1995A1" } } }, { "@date" : "1996-01-01", "els" : {
"e" : { "k" : "YEARS:1.1.1996", "n" : "1996A1" } } }, { "@date" : "1997-01-01", "els" :
{ "e" : { "k" : "YEARS:1.1.1997", "n" : "1997A1" } } }, { "@date" : "1998-01-01",
"els" : { "e" : { "k" : "YEARS:1.1.1998", "n" : "1998A1" } } }, {
"@date" : "1999-01-01", "els" : { "e" : { "k" : "YEARS:1.1.1999", "n" : "1999A1" } } },
{ "@date" : "2000-01-01", "els" : { "e" : { "k" : "YEARS:1.1.2000", "n" : "2000A1" } }
}, { "@date" : "2001-01-01", "els" : { "e" : { "k" : "YEARS:1.1.2001", "n" : "2001A1" }
} }, { "@date" : "2002-01-01", "els" : { "e" : { "k" : "YEARS:1.1.2002", "n" : "2002A1"
} } }, { "@date" : "2003-01-01", "els" : { "e" : { "k" : "YEARS:1.1.2003",
"n" : "2003A1" } } }, { "@date" : "2004-01-01", "els" : { "e" : {
"k" : "YEARS:1.1.2004", "n" : "2004A1" } } }, { "@date" : "2005-01-01", "els" : { "e" :
{ "k" : "YEARS:1.1.2005", "n" : "2005A1" } } }, { "@date" : "2006-01-01", "els" : {
"e" : { "k" : "YEARS:1.1.2006", "n" : "2006A1" } } }, { "@date" : "2007-01-01", "els" :
{ "e" : { "k" : "YEARS:1.1.2007", "n" : "2007A1" } } }, { "@date" : "2008-01-01",
"els" : { "e" : { "k" : "YEARS:1.1.2008", "n" : "2008A1" } } }, {
"@date" : "2009-01-01", "els" : { "e" : { "k" : "YEARS:1.1.2009", "n" : "2009A1" } } },
{ "@date" : "2010-01-01", "els" : { "e" : { "k" : "YEARS:1.1.2010", "n" : "2010A1" } }
}, { "@date" : "2011-01-01", "els" : { "e" : { "k" : "YEARS:1.1.2011", "n" : "2011A1" }
} }, { "@date" : "2012-01-01", "els" : { "e" : { "k" : "YEARS:1.1.2012", "n" : "2012A1"
} } }, { "@date" : "2013-01-01", "els" : { "e" : { "k" : "YEARS:1.1.2013",
"n" : "2013A1" } } }, { "@date" : "2014-01-01", "els" : { "e" : {
"k" : "YEARS:1.1.2014", "n" : "2014A1" } } }, { "@date" : "2015-01-01", "els" : { "e" :
{ "k" : "YEARS:1.1.2015", "n" : "2015A1" } } }, { "@date" : "2016-01-01", "els" : {
"e" : { "k" : "YEARS:1.1.2016", "n" : "2016A1" } } }, { "@date" : "2017-01-01", "els" :
{ "e" : { "k" : "YEARS:1.1.2017", "n" : "2017A1" } } }, { "@date" : "2018-01-01",
"els" : { "e" : { "k" : "YEARS:1.1.2018", "n" : "2018A1" } } }, {
"@date" : "2019-01-01", "els" : { "e" : { "k" : "YEARS:1.1.2019", "n" : "2019A1" } } },
{ "@date" : "2020-01-01", "els" : { "e" : { "k" : "YEARS:1.1.2020", "n" : "2020A1" } }
} ] } }, "rows" : { "dims" : { "it" : {
"k" : "0", "id" : "series" } }, "slots" : { "s" : [ { "els" :
{ "e" : { "k" : "MyInputVavable", "n" : "MyInputVavable" } } }, { "els" :
{ "e" : { "k" : "MyOutputVavable", "n" : "MyOutputVavable" } } } ] }
}, "cells" : { "c" : [ { "@v" : "1.000000", "@dt" : "3", "@row" : "0", "@column" : "0",
"@date" : "1990-01-01" }, { "@v" : "-1.700000", "@dt" : "3", "@row" : "0", "@column" : "1", "@date" : "1991-01-01" }, {
"@v" : "7.200000", "@dt" : "3", "@row" : "0", "@column" : "2", "@date" : "1992-01-01" }, { "@v" : "-1.000000", "@dt" : "3", "@row" : "0",
"@column" : "3", "@date" : "1993-01-01" }, { "@v" : "5.000000", "@dt" : "3", "@row" : "0", "@column" : "4", "@date" : "1994-01-01" },
{ "@v" : "0.200000", "@dt" : "3", "@row" : "0", "@column" : "5", "@date" : "1995-01-01" }, { "@v" : "6.600000", "@dt" : "3",
"@row" : "0", "@column" : "6", "@date" : "1996-01-01" }, { "@v" : "-0.500000", "@dt" : "3", "@row" : "0", "@column" : "7", "@date" : "1997-01-01"
}, { "@v" : "3.200000", "@dt" : "3", "@row" : "0", "@column" : "8", "@date" : "1998-01-01" }, { "@v" : "2.000000",
"@dt" : "3", "@row" : "0", "@column" : "9", "@date" : "1999-01-01" }, { "@v" : "3.000000", "@dt" : "3", "@row" : "0", "@column" : "10",
"@date" : "2000-01-01" }, { "@v" : "6.200000", "@dt" : "3", "@row" : "0", "@column" : "11", "@date" : "2001-01-01" }, {
"@v" : "7.100000", "@dt" : "3", "@row" : "0", "@column" : "12", "@date" : "2002-01-01" }, { "@v" : "5.800000", "@dt" : "3", "@row" : "0",
"@column" : "13", "@date" : "2003-01-01" }, { "@v" : "2.800000", "@dt" : "3", "@row" : "0", "@column" : "14", "@date" : "2004-01-01" },
{ "@v" : "3.700000", "@dt" : "3", "@row" : "0", "@column" : "15", "@date" : "2005-01-01" }, { "@v" : "4.454652", "@dt" : "3",
"@row" : "0", "@column" : "16", "@date" : "2006-01-01" }, { "@v" : "3.200000", "@dt" : "3", "@row" : "0", "@column" : "17", "@date" : "2007-01-01"
}, { "@v" : "3.600000", "@dt" : "3", "@row" : "0", "@column" : "18", "@date" : "2008-01-01" }, { "@v" : "8.000000",
"@dt" : "3", "@row" : "0", "@column" : "19", "@date" : "2009-01-01" }, { "@v" : "7.000000", "@dt" : "3", "@row" : "0", "@column" : "20",
"@date" : "2010-01-01" }, { "@v" : "4.000000", "@dt" : "3", "@row" : "1", "@column" : "0", "@date" : "1990-01-01" }, {
"@v" : "3.000000", "@dt" : "3", "@row" : "1", "@column" : "2", "@date" : "1992-01-01" }, { "@v" : "2.000000", "@dt" : "3", "@row" : "1",
"@column" : "3", "@date" : "1993-01-01" }, { "@v" : "3.800000", "@dt" : "3", "@row" : "1", "@column" : "4", "@date" : "1994-01-01" },
{ "@v" : "1.200000", "@dt" : "3", "@row" : "1", "@column" : "5", "@date" : "1995-01-01" }, { "@v" : "2.000000", "@dt" : "3",
"@row" : "1", "@column" : "7", "@date" : "1997-01-01" }, { "@v" : "1.100000", "@dt" : "3", "@row" : "1", "@column" : "8", "@date" : "1998-01-01"
}, { "@v" : "5.400000", "@dt" : "3", "@row" : "1", "@column" : "9", "@date" : "1999-01-01" }, { "@v" : "1.000000",
"@dt" : "3", "@row" : "1", "@column" : "10", "@date" : "2000-01-01" }, { "@v" : "-1.700000", "@dt" : "3", "@row" : "1", "@column" : "11",
"@date" : "2001-01-01" }, { "@v" : "7.200000", "@dt" : "3", "@row" : "1", "@column" : "12", "@date" : "2002-01-01" }, {
"@v" : "-1.000000", "@dt" : "3", "@row" : "1", "@column" : "13", "@date" : "2003-01-01" }, { "@v" : "5.000000", "@dt" : "3", "@row" : "1",
"@column" : "14", "@date" : "2004-01-01" }, { "@v" : "0.200000", "@dt" : "3", "@row" : "1", "@column" : "15", "@date" : "2005-01-01" },
{ "@v" : "6.600000", "@dt" : "3", "@row" : "1", "@column" : "16", "@date" : "2006-01-01" }, { "@v" : "-0.500000", "@dt" : "3",
"@row" : "1", "@column" : "17", "@date" : "2007-01-01" }, { "@v" : "3.200000", "@dt" : "3", "@row" : "1", "@column" : "18", "@date" : "2008-01-01"
}, { "@v" : "2.000000", "@dt" : "3", "@row" : "1", "@column" : "19", "@date" : "2009-01-01" }, { "@v" : "3.000000",
"@dt" : "3", "@row" : "1", "@column" : "20", "@date" : "2010-01-01" } ] } } } },
"chainWorkbookEax" : { "id" : { "id" : "" }, "meta" : { "obInst" : {
"obDesc" : { "@isShortcut" : "0", "i" : "CHAINWB_2804", "n" : "ChainWorkBook", "k" : "2837", "c" : "2827", "p" : "2804", "h" : "0" }
}, "dirty" : "1", "dataEditState" : { "readOnly" : "0", "modified" : "0" }, "grid" : { "style" :
{ "table" : { "Name" : "EAX table style", "Range" : { "left" : "0", "top" : "0", "width" : "0", "height" : "0"
}, "Corner" : { "@B" : "", "Text" : { "@VA" : "-1", "@HA" : "-1", "@M" : "-3.78 -3.78 -3.78 -3.78", "@WW" : "-1"
}, "Fill" : { "@C" : "#E6E9F5" }, "Font" : { "@A" : "0", "@B" : "false", "@SO" : "false",
"@S" : "10.670000", "@C" : "#000000", "@U" : "false", "@F" : "Arial", "@I" : "false" }, "Borders" : "", "Hyperlink" : "" }, "FirstRow" :
{ "Width" : "1", "Style" : { "@B" : "", "Text" : { "@VA" : "-1", "@HA" : "-1", "@M" : "-3.78 -3.78 -3.78 -3.78",
"@WW" : "-1" }, "Fill" : { "@C" : "#FFFFFF" }, "Font" : { "@A" : "0", "@B" : "false",
"@SO" : "false", "@S" : "10.670000", "@C" : "#000000", "@U" : "false", "@F" : "Arial", "@I" : "false" }, "Borders" : "", "Hyperlink" : "" }
}, "SecondRow" : { "Width" : "1", "Style" : { "@B" : "", "Text" : { "@VA" : "-1",
"@HA" : "-1", "@M" : "-3.78 -3.78 -3.78 -3.78", "@WW" : "-1" }, "Fill" : { "@C" : "#EEEEEE" }, "Font" : {
"@A" : "0", "@B" : "false", "@SO" : "false", "@S" : "10.670000", "@C" : "#000000", "@U" : "false", "@F" : "Arial", "@I" : "false" }, "Borders" : "",
"Hyperlink" : "" } }, "FirstColumn" : { "Width" : "1" }, "SecondColumn" : { "Width" : "1"
}, "HeaderRow" : { "Width" : "0", "Style" : { "@B" : "", "Text" : { "@VA" : "-1",
"@HA" : "-1", "@M" : "-3.78 -3.78 -3.78 -3.78", "@WW" : "-1" }, "Fill" : { "@C" : "#EEEEEE" }, "Font" : {
"@A" : "0", "@B" : "false", "@SO" : "false", "@S" : "10.670000", "@C" : "#000000", "@U" : "false", "@F" : "Arial", "@I" : "false" }, "Borders" :
{ "Border" : [ { "@S" : "0", "@C" : "#BBBBBB", "@I" : "2" }, { "@S" : "0",
"@C" : "#BBBBBB", "@I" : "5" }, { "@S" : "0", "@C" : "#FFFFFF", "@I" : "6" }, { "@S" : "0",
"@C" : "#FFFFFF", "@I" : "7" } ] }, "Hyperlink" : "" } }, "HeaderColumn" : {
"Width" : "1", "Style" : { "@B" : "", "Text" : { "@VA" : "-1", "@HA" : "-1", "@M" : "-3.78 -3.78 -3.78 -3.78", "@WW" : "-1"
}, "Fill" : { "@C" : "#E6E9F5" }, "Font" : { "@A" : "0", "@B" : "false", "@SO" : "false",
"@S" : "10.670000", "@C" : "#000000", "@U" : "false", "@F" : "Arial", "@I" : "false" }, "Borders" : { "Border" : [
{ "@S" : "0", "@C" : "#BBBBBB", "@I" : "3" }, { "@S" : "0", "@C" : "#BBBBBB", "@I" : "4" },
{ "@S" : "0", "@C" : "#FFFFFF", "@I" : "6" }, { "@S" : "0", "@C" : "#FFFFFF", "@I" : "7" }
] }, "Hyperlink" : "" } }, "FooterRow" : { "Width" : "0" }, "FooterColumn" :
{ "Width" : "0" }, "PredefinedStyle" : "ExtBlueStriped", "IsEmpty" : "0" } } }, "windowsPosition" : "Vertical", "hasPivot" : "0"
} } } } } } } } } } }
The GetMsModelData function gets data of the specified model. Input parameters:
ms. Opened modeling container instance.
modelKey. Model key.
After execution the function returns a workbook that contains the model data. The data is also displayed in the console window.
public static GetWbkMdResult GetMsModelData(MsId ms, ulong modelKey) { var getMsOp = new GetMs(); getMsOp.tMs = ms; getMsOp.tArg = new GetMsArg() { // Set data get pattern pattern = new MsMdPattern() { item = new MsItemPattern() { // Specify model key key = modelKey,
problem = new MsProblemPattern() { metamodel = new MsMetaModelPattern() { // Set pattern for visual building of metamodel visualControllerPattern = new MsMetaModelVisualControllerPattern() { // Set internal workbook getting pattern chainWorkbook = new GetWbkMdArg() { pattern = new WbkMdPattern() {
cellsTable = new WbkCellsTablePattern() { headers = true, cells = true, emptyCells = false, slots = new PvtSlotPattern() {elementName = true } } } },// Set internal express view getting pattern chainWorkbookEax = new GetEaxMdArg()
{ pattern = new EaxMdPattern() { dataSource = new CubeDataSourcePattern() { }, dataEditState = true, gridStyle = new EaxGridStylePattern() { all = false, parts = new EaxGridStylePart[] { EaxGridStylePart.Table } }
} } } } } } },// Set operation execution parameters execParams = new MsMdExecParams(){execFillChain = true} }; // Create proxy object for operation execution
var somClient = new SomPortTypeClient(); // Get model data GetMsResult getMsResult = somClient.GetMs(getMsOp); // Output model data MsMetaModelVisualController metaVC = getMsResult.meta.item.problemMd.metamodel.visualController; WbkCellsTable table = metaVC.chainWorkbook.meta.cellsTable; int ar = table.cells.Length; Console.WriteLine("Date - Value"); ulong row = 0; ulong rowAft = 2; int nowRow = 0; for (int i = 0; i
See also: