In a SLNet Plugin context, I am retrieving the content of an element table as a ParameterValue object.
After drilling down to the cell (e.g. via the method "ParameterValue.GetTableCell"), I can now retrieve the "raw" value of the cell via the combination "CellValue.InteropValue". This works as intended.
However, in some cases I want to retrieve the display value of the cell. I have tried both "CellValue.CellDisplayValue" as well as only "CellDisplayValue", however in both cases I only receive an empty string, independent of the type of the column parameter.
In my reference code, the cell display value is retrieved by looking up the raw value of the discreet parameter in a separate reference, however this is not possible for me.
What would be the right syntax in this context?
Hi Tobias,
You can retrieve the discreet display as follows:
GetElementByIDMessage getElementInfoMsg = new GetElementByIDMessage
{
DataMinerID = iDmaID, // Dataminer ID where the element is hosted.
ElementID = iElementID, // Element ID.
};ElementInfoEventMessage elementInfo = protocol.SLNet.SendSingleResponseMessage(getElementInfoMsg) as ElementInfoEventMessage;
GetProtocolMessage getProtocolMsg = new GetProtocolMessage(elementInfo.Protocol, elementInfo.ProtocolVersion);
GetProtocolInfoResponseMessage response = protocol.SLNet.SendSingleResponseMessage(getProtocolMsg) as GetProtocolInfoResponseMessage;
foreach (var param in response.Parameters)
{
// iParamID is the column parameter ID from which you want to get the discreet display
if (param.ID == iParamID)
{
foreach (var discreet in param.Discreets)
{
// here you can get the value and display for each discreet as discreet.Value and discreet.Display. Then you can apply any filtering/if clause to get the discreet display for a given discreet value.
}
}
}
Do note that SLNet messages are subject to change and breaking changes might be introduced in new versions of Dataminer.
Thank you for the response. I ended up finding an alternative way using an external reference, however it is good to see an example for a protocol data lookup.