In a protocol, I need to retrieve the value of a parameter from another element than the one where the QAction is written. I try to use something as follow which works in an Automation script but using a "GetParameter" instead of SetParameter:
Element element = engine.FindElement("RFSW GS02 SA J5");
if (element != null) {
//Set the connectedInput value (parameter id 1012) to 6 (port number)
pos = Convert.ToString(element.GetParameter(1012));
}
But if I use this script in the QAction of the driver I am writing, it generates an error, saying there is no "Element" class. So I guess there is something missing. Is there any solution?
Thank you,
Hi Dominique,
The Element class is specific to the automation scripts (see reference), an alternative you can use is the IDmsElement object from the Class Library and your code would look something like
var idms = protocol.GetDms();
var element = idms.GetElement("RFSW GS02 SA J5");
if (element != null) {
//Set the connectedInput value (parameter id 1012) to 6 (port number)
var posParameter = element.GetStandaloneParameter<string>(1012));
var pos = posParameter.GetValue();
}
To learn more about the Class Library, you can check this docs page: About the class library | DataMiner Docs
Hope this can help
Yes, you need to install the NuGet from https://www.nuget.org/packages/Skyline.DataMiner.Core.DataMinerSystem.Protocol
Noted. But if there is a Dataminer update later on, will it take into account the update of the NuGet package, if needed?
We try to make sure those NuGets are always forward-compatible and that DataMiner does not introduce breaking changes to those.
However, upgrading your DataMiner will not automatically upgrade the NuGets, that remains a manual action.
Hi João,
Understood. Lany thanks for your kind support 🙂
Thank you João,
Nearly there, I thing. The following script still returns with one error on first line:
var idms = protocol.GetDms();
var element = idms.GetElement("RFSW GS02 SA J5");
if (element != null)
{
var posParameter = element.GetStandaloneParameter<string>(1012);
pos = posParameter.GetValue();
}
Error: CS1061 'SLProtocol' does not contain a definition for 'GetDms'
Do I need to add some library or something like that?