Below is the example of using the GetRdsElements operation to get history of MDM dictionary elements. The request contains moniker of opened dictionary instance. The response contains information about elements history. Each history record contains the following data: element name at the corresponding period, values of all attributes, start date and end date of the period.
{ "GetRdsElements" : { "tRds" : { "id" : "S1!M!S!N10" }, "tArg" : { "parent" : { "key" : "" }, "filter" : { "levels" : "-1", "includeRoot" : "false", "onlySelected" : "false", "includeParents" : "true", "includeParentsWithSiblings" : "true" }, "pattern" : { "attributes" : "*", "attributeValuesOnly" : "false", "extendedAttributeValuesOnly" : "true", "getSelectState" : "true", "getParentKey" : "true", "getHasChildren" : "true", "getLevel" : "true", "getHasSelectedChildren" : "true", "getHistory" : "true", "getImageIndex" : "true" } } } }
{ "GetRdsElementsResult" : { "els" : { "e" : { "@hc" : "0", "@l" : "1", "n" : "Fact", "ea" : { "it" : [ { "@v" : "430" }, { "@v" : "Fact" }, "", { "@v" : "430" }, { "@v" : "430" }, { "@v" : "2012-01-01" }, { "@v" : "2012-01-02" }, "", "" ] }, "k" : "430", "h" : "0", "o" : "0", "p" : "4294967294", "hist" : { "it" : [ { "n" : "Fact", "ea" : { "it" : [ { "@v" : "430" }, { "@v" : "Fact" }, "", { "@v" : "430" }, { "@v" : "430" }, { "@v" : "2012-01-01" }, { "@v" : "2012-01-02" }, "", "" ] }, "inDate" : "2012-01-01", "outDate" : "2012-01-02" }, { "n" : "Fact 1", "ea" : { "it" : [ { "@v" : "430" }, { "@v" : "Fact 1" }, "", { "@v" : "430" }, { "@v" : "431" }, { "@v" : "2012-01-02" }, { "@v" : "2012-01-03" }, "", "" ] }, "inDate" : "2012-01-02", "outDate" : "2012-01-03" }, { "n" : "Fact 1", "ea" : { "it" : [ { "@v" : "430" }, { "@v" : "Fact 1" }, "", { "@v" : "430" }, { "@v" : "432" }, { "@v" : "2012-01-03" }, { "@v" : "2999-12-31" }, "", "" ] }, "inDate" : "2012-01-03", "outDate" : "2999-12-31" } ] } } }, "id" : { "id" : "S1!M!S!N10" } } },
The GetHistoryElements function returns a list of elements and the history of changes for each of the elements. The dictionary instance moniker is sent as an input parameter. The example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier section. After executing the function returns result of the GetRdsElements operation.
public static GetRdsElementsResult GetHistoryElements(RdsId moniker)
{
var somClient = new SomPortTypeClient(); // Proxy object for operation execution
//Operation execution parameters
var tGet = new GetRdsElements()
{
tArg = new GetRdsElementsArg()
{
parent = new ElKey
{
key = string.Empty
},
filter = new ElsFilter
{
includeRoot = false,
includeParents = true,
includeParentsWithSiblings = true,
onlySelected = false,
levels = -1
},
pattern = new ElsPattern // Data get pattern
{
getParentKey = true,
getHasChildren = true,
getHasSelectedChildren = true,
getLevel = true,
getSelectState = true,
getHistory = true,
attributes = "*",
attributeValuesOnly = false,
extendedAttributeValuesOnly = true
},
},
tRds = moniker
};
// Get history of elements changes
var tResult = somClient.GetRdsElements(tGet);
return tResult;
}
See also: