Hello,
I need to to identify if there is a view with a specific name within the parent's tree of an element. The need is to traverse the tree from the leaf node up to the root looking for a matching.
If an element A is attached to the views WI002 and TVE, and we want to check if one of the parents' nodes contains "Platform", the script needs to analyze the following walk "WI002->Platform->iNOC" and "TVE->IPVS".
I've tried with this code
but I’ve back only WI002 and TVE.
Could you please share with me a code snippet to implement this logic?
Thanks
Simone
Hi Simone, that can be done relatively easy using the class library:
var dms = engine.GetDms();
var e = dms.GetElement("MyElement");
var isInView = IsInView(e, "MyView");
public bool IsInView(IDmsElement element, string viewName)
{
foreach (var elementView in element.Views)
{
var view = elementView;
while (view != null)
{
if (String.Equals(view.Name, viewName))
{
return true;
}
view = view.Parent;
}
}
return false;
}
Hi Simone, the GetDms method and Skyline.DataMiner.Library.Automation are both part of the class library. Unfortunately, in order to use them you’ll need to use DIS and Visual Studio. Do you have a DIS license?
Hi,
From today onwards, Simone Rosignoli has a DIS License, transferred from another colleague of Eutelsat that does not need the license anymore. So we from the Sphinx Squad will try to help him further out.
Kind regards,
Joachim
Hi Tom,
many thanks for your answer. I've tried the code but I've got the following error: "'Engine' does not contain a definition for 'GetDms'".
My Dataminer version is the 10.2. I'm using the namespace 'Skyline.DataMiner.Automation', I've tried also with ' Skyline.DataMiner.Library.Automation' but I've got an error saying that the namespace name 'Library' doesn't exist in Skyline.DataMiner.
Could you please help me on this?
Thanks
Hi Tom,
many thanks for your answer. I’ve tried the code but I’ve got the following error: “‘Engine’ does not contain a definition for ‘GetDms'”.
My Dataminer version is the 10.2. I’m using the namespace ‘Skyline.DataMiner.Automation’, I’ve tried also with ‘ Skyline.DataMiner.Library.Automation’ but I’ve got an error saying that the namespace name ‘Library’ doesn’t exist in Skyline.DataMiner.