Scripting Advanced Search Unique Property Value Queries in DIAdem

コードとドキュメント

添付

Overview

This example shows how to script the use of the "..." button Text Display Dialog Box from the Advanced Search in DIAdem, to retrieve custom property unique values.

 

Description

This example uses the GettValueList for IndexedProperty method to retrieve the unique values from a custom UUT_Type Chanel Group property. The custom property must be previously optimized for DataFinder for the script to work.

 

The Provided files have a UUT_Type custom property with a value equals to Type_A, Type_B or Type_C.

 

The files directory MUST be added as a search directory in DataFinder.

 

You can load the files in the DataPortal for manual inspection of the Custom Property.

 

Hardware and Software Requirements

DIAdem 2019 (that's the version I used, should work in previous versions).

 

Steps to Implement or Execute Code

1. Unzip the files.

2. Set the Files folder a as a Search Areas in DIAdem NAVIGATOR, or add it to an existing one.

3. Optimize the UUT_Type custom property for DataFinder. Otherwise, the method will only work for basic properties, as explained in the "..." button Text Display (DataFinder) dialog box help topic.

4. Run the script.

 

 

'-------------------------------------------------------------------------------
' This script shows how to use the GettValueList for IndexedProperty method to retrieve the unique
' values from a custom "UUT_Type" property. The custom property must be previously optimized for
' DataFinder for the script to work.
' The Provided files have a "UUT_Type" custom property with a value equals to ' "Type_A", "Type_B"
' or "Type_C".
' The files directory MUST be added as a search directory in DataFinder.
' Load the files in the DataPortal for manual inspection of the Custom Property.
'-------------------------------------------------------------------------------

Option Explicit  'Forces the explicit declaration of all the variables in a script.
Dim MyDataFinder, MyProperties, MyAdaptiveQuery, MyPropertyName, MyPropertyValues, MyFileNames, i, j

' Set custom property name
MyPropertyName = "UUT_Type"

' Obtain DataFinder reference
Set MyDataFinder = Navigator.ConnectDataFinder("My DataFinder")

' Get list of DataFinder indexed properties properties
Set MyProperties = MyDataFinder.GetIndexedProperties(esearchfile)

' Get list of MyPropertyName ("UUT_Type") values and store in variable
set MyPropertyValues = MyProperties.Item(MyPropertyName).GetValueList()


' The following code just verifies the values were retrieved correctly by displaying them in a message box
Dim MyOutput
For i = 1 To MyPropertyValues.Count		' Iterate for each unique value in MyPropertyName
  Myoutput = ""
  
  ' Create and call an advanced search query for a unique property value at a time
  Set MyAdaptiveQuery = Navigator.ConnectDataFinder("My DataFinder").CreateQuery(eAdvancedQuery)
  Call MyAdaptiveQuery.Conditions.Add(eSearchFile, MyPropertyName, "=", MyPropertyValues.Values(i))
  
  ' Retrieve list of files with matching property name
  Set MyFileNames = MyProperties.Item("FileName").GetValueList(MyAdaptiveQuery)
 
  ' Store property value and file names in output message variable
  MyOutput = MyFileNames.Count & " files with "& MyPropertyName &" = " & MyPropertyValues.Values(i) & vbCrLf    
  for j = 1 to MyFileNames.Count
    MyOutput = MyOutput & vbCrLf & MyFileNames.Values(j)
  Next
  
  ' Display message box with results
  msgbox MyOutput

' Iterate next unique property value
Next
Refer to the KowledgeBase article linked under Additional Information for further details.

 

 

Camilo V.
National Instruments

NIコミュニティのサンプルコード交換のサンプルコードは、MIT Licenseによりライセンス供与されています。

寄稿者