Below is the example of using the GetDimElements operation to select elements by their keys. The key is the value of the Identifier attribute for an element. The request contains moniker of opened dictionary instance and the collection of element keys. Identifiers and names will be loaded for selected elements.
{
"GetDimElements" :
{
"tDim" :
{
"id" : "S1!M!S!S1"
},
"tArg" :
{
"filter" :
{
"keys" :
{
"it" :
[
{
"key" : "1"
},
{
"key" : "2"
},
{
"key" : "3"
}
]
},
"includeParents" : "false",
"includeParentsWithSiblings" : "false"
},
"pattern" :
{
"attributes" : "ID;NAME"
}
}
}
}
{
"GetDimElementsResult" :
{
"els" :
{
"e" :
[
{
"n" : "Item 1",
"a" :
{
"it" :
[
"1",
"Item 1"
]
},
"ea" :
{
"it" :
[
{
"@v" : "1"
},
{
"@v" : "Item 1"
}
]
},
"k" : "1",
"h" : "0",
"o" : "0"
},
{
"n" : "Item 2",
"a" :
{
"it" :
[
"2",
"Item 2"
]
},
"ea" :
{
"it" :
[
{
"@v" : "2"
},
{
"@v" : "Item 2"
}
]
},
"k" : "2",
"h" : "0",
"o" : "1"
},
{
"n" : "Item 3",
"a" :
{
"it" :
[
"3",
"Item 3"
]
},
"ea" :
{
"it" :
[
{
"@v" : "3"
},
{
"@v" : "Item 3"
}
]
},
"k" : "3",
"h" : "0",
"o" : "2"
}
]
},
"id" :
{
"id" : "S1!M!S!S1"
}
}
}
public static GetDimElementsResult GetElementsByKeys(DmId moniker, ElKey[] elKeys)
{
var somClient = new SomPortTypeClient(); //Proxy object for executing operations
//Operation execution parameters
var tElements = new GetDimElements()
{
tArg = new GetDimElementsArg()
{
pattern = new ElsPattern()
{
attributes = "ID;NAME"
},
//Elements filtering parameters
filter = new ElsFilter()
{
keys = elKeys
}
},
tDim = moniker
};
//Get information about dictionary elements
var result = somClient.GetDimElements(tElements);
return result;
}
See also:
SOAP