DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Find properties that do not exist

Is there a direct way to search for properties that do not exist? I know you can search for the all the elements and then add the property to the result list and parse from there but seems like there should be a conditional that is DNE so you can quickly find elements that do not contain a property.

0 Kudos
Message 1 of 2
(70 Views)

Hi PacoBean,

 

I agree that would be very nice to have, but such a functionality sadly... does not exist, at least not up to DIAdem 2021.

 

One thing that may help you with this scenario is the free ElementList object in the NAVIGATOR api, which has the option to merge different Search Results to form the logical Union, Intersection, etc.  Here's an example of a script that runs 2 queries and then merges the results to find the differences... without line by line comparisons.

OPTION EXPLICIT
Dim DataFinder, QueryForm, Results, MergeElementList, MergeMethod
MergeMethod = ListMergeModeAdd
MergeMethod = ListMergeModeUnion
MergeMethod = ListMergeModeIntersection
MergeMethod = ListMergeModeDifference
MergeMethod = ListMergeModeSymetricDifference
Set DataFinder = Navigator.Display.CurrDataFinder
Set QueryForm  = DataFinder.QueryForm
Set MergeElementList = DataFinder.GetDataFinder.CreateElementList()
Call ConfigQuery1(QueryForm)
Call QueryForm.Search()
Set Results = DataFinder.ResultsList.ResultsElements
Call MergeElementList.AddElementList(Results, MergeMethod)
Call ConfigQuery2(QueryForm)
Call QueryForm.Search()
Set Results = DataFinder.ResultsList.ResultsElements
Call MergeElementList.AddElementList(Results, MergeMethod)
Call WndShow("NAVIGATOR")
MsgBox OutputList(MergeElementList)


Sub ConfigQuery1(QueryForm)
  Call QueryForm.Clear()
  QueryForm.Mode        = eAdvancedQueryForm
  QueryForm.ReturnType  = eSearchFile
  QueryForm.ResultsMode = eResultsModeElements
  Call QueryForm.Conditions.Add(eSearchFile, "UUT", "=", "T17-A11")
  Call QueryForm.Conditions.Add(eSearchFile, "Test~Operator", "=", "Linda OR Paul")
End Sub ' ConfigQuery1()


Sub ConfigQuery2(QueryForm)
  Call QueryForm.Clear()
  QueryForm.Mode        = eAdvancedQueryForm
  QueryForm.ReturnType  = eSearchFile
  QueryForm.ResultsMode = eResultsModeElements
  Call QueryForm.Conditions.Add(eSearchFile, "UUT", "=", "T17-A11")
  Call QueryForm.Conditions.Add(eSearchFile, "Test~Operator", "=", "Paul")
End Sub ' ConfigQuery1()


Function OutputList(ElementList)
  Dim i, iMax, Msg
  iMax = ElementList.Count
  Msg = "Result Count = " & iMax
  FOR i = 1 TO iMax
    Msg = Msg & vbCRLF & ElementList(i).Name
    IF ElementList(i).Properties.Exists("Test~Operator") THEN
      Msg = Msg & vbTAB & vbTAB & ElementList(i).Properties("Test~Operator").Value
    END IF
  NEXT ' i
OutputList = Msg
End Function ' OutputList()

Brad Turpin

Principal Technical Support Engineer
NI

0 Kudos
Message 2 of 2
(13 Views)