Hi:
I am building a dataminer automation script using C# code.
I noticed we can get element lists from a view:
Element[] elements = engine.FindElementsInView("MyView");
Is there a way that in C# code we can get the element lists from service name? e.g.
Element[] elements = engine.FindElementsInService("MyService");
Thanks
Hi Pengf,
Below an equivalent method using only Engine class:
public static IEnumerable<Element> FindElementsInService(this Engine engine, Service service)
{
if (engine == null)
{
throw new ArgumentNullException(nameof(engine));
}if (service == null)
{
throw new ArgumentNullException(nameof(service));
}IEnumerable<Element> FindElementsInServiceIterator()
{
if (service.ServiceInfo?.ServiceParams == null)
{
yield break;
}foreach (var serviceParam in service.ServiceInfo.ServiceParams)
{
if (serviceParam.IsService)
{
continue;
}yield return engine.FindElement(serviceParam.DataMinerID, serviceParam.ElementID);
}
}return FindElementsInServiceIterator();
}