How can I get the list of all protocols in c# and show them in the low code app in dropdown as adhoc-data source?
As in GQI I cannot see any way like engine.GetUserConnection().GetProtocols?
OR
I can see I can get protocols all from Low code app directly, but how can I adjust to bring only names from Query?
Hi Apurva,
You could leverage the DMS callback that allows you to send any SLNet message (see docs). This callback can be used to retrieve all elements using the 'GetLiteElementInfo' message. These 'LiteElementInfoEvent' responses can then be used to get a list of protocols from them. (This is the way used by our dashboards)
private HashSet<string> GetProtocols()
{
var message = new GetLiteElementInfo()
{
ExcludeSubViews = false,
ViewID = -1,
IncludeHidden = false,
IncludePaused = true,
IncludeStopped = true
};
var elementInfos = _dms.SendMessages(message).OfType<LiteElementInfoEvent>();var protocols = new HashSet<string>();
foreach(var elementInfo in elementInfos)
{
if (protocols.Contains(elementInfo.Protocol)) continue;
protocols.Add(elementInfo.Protocol);
}return protocols;
}
My example only retrieves the protocol names, but you can also get the protocol type, protocol version, ... from these responses.
The retrieved protocols can then be returned as rows by your ad hoc source (see docs).
An other option is to use the same callback with an 'GetInfoMessage' to retrieve all protocols.