Via code I would need to find the resource on a system based on a DVE that represents the equipment.
For example I have a Main Element using the iControl connector. This element generates a DVE per output (iControl.EXT-A, iControl.EXT-B ...)
For each of these outputs a (function)resource is created on the system.
Via an automation script, I now need to find this function resource starting from the (equipment) DVE dmaId/elementId
Can you please share me a code example?
Hi Mieke,
If you want the exact function resource (pseudo code):
var functionID = Guid.NewGuid(); var dveElement = new LiteElementInfoEvent(); //server filter FilterElement<Resource> dveFunctionFilter = FunctionResourceExposers.FunctionGUID.Equal(functionID).AND( FunctionResourceExposers.MainDVEDmaID.Equal(dveElement.DveParentDmaId).AND( FunctionResourceExposers.MainDVEElementID.Equal(dveElement.DveParentElementId).AND( ResourceExposers.DmaID.Equal(dveElement.DataMinerID).AND( ResourceExposers.ElementID.Equal(dveElement.ElementID))))); //client filter Predicate<Resource> dveFunctionPredicate = r => { return r is FunctionResource fr && fr.FunctionGUID == functionID && fr.MainDVEElementID == dveElement.DveParentDmaId && fr.MainDVEElementID == dveElement.DveParentElementId && fr.DmaID == dveElement.DataMinerID && fr.ElementID == dveElement.ElementID; };
If you want the entry point (pseudo code):
var count = 0; _config = new FunctionResource(); FunctionEntryPoint[] entryPoints = new Skyline.DataMiner.Net.Messages.ProtocolFunctionHelper().GetFunctionEntryPoints(_config.FunctionGUID, _config.MainDVEDmaID, _config.MainDVEElementID).ToArray(); bool IsSameEntryPoint(EntryPointData entry) { return entry?.Element != null && entry.Element.DataMinerID == _config.DmaID && entry.Element.EID == _config.ElementID; } while (count < entryPoints.Length && wrapper == null) { if (entryPoints[count] is FunctionEntryPoint data && data.Data is EntryPointData[] arrayData) { var dataCount = 0; while (dataCount < arrayData.Length && wrapper == null) { if (arrayData[dataCount] is EntryPointData entry && IsSameEntryPoint(entry)) { wrapper = new EntryPointWrapper(entry, data.ParameterID); } dataCount++; } } count++; }