Hello, i need help with a function that will get all parameters of a Element and their values, and set it in another Element. If anyone can help me, I will be grateful!
e.g: I have element01 and element01_copy, thei have the same parameters but the copy need to get the values inserted from the original element.
Hi Tom, you helped me with the question about cloning an element via C#, and now i need to get the parameters value of that original element and set it in the clone one.
E.g: Element01 has a parameter dummy1 with value 1, when i cloned the Element01 it created the Element01_clone and it come with the parameters from the original but not initialized. I want to set the same value of each parameters from the original element to the new one.
I tried find a function that count the number of parameters that the element have, but can’t find one.
Hi Joao,
Could you let us know why you need element duplication? Maybe there is another DataMiner functionality that can help you with this requirement.
Hi João,
Using the following code, all parameters and their properties can be retrieved:
var dms = engine.GetDms();
var element = dms.GetElement("element01");var protocolInfo = engine.GetUserConnection().GetProtocol(element.Protocol.Name, element.Protocol.Version);
foreach (var param in protocolInfo.Parameters)
{
var id = param.ID;
var name = param.Name;
var description = param.Description;....
}
More information can also be found in this similar question: https://community.dataminer.services/question/getting-table-ids-and-protocol-related-data-in-automation-script/
Hi João, could you please elaborate what exactly you want to achieve? Is the element polling data from a device, or is it a virtual protocol. Does every read parameter also have a write parameter that can be set?
Depending on what you’re trying to do, element connections could be an option: https://docs.dataminer.services/develop/devguide/Connector/AdvancedInterElementCommunicationElementConnections.html.