DIAdem Help

Generating Custom Properties with a Script

  • Updated2024-09-12
  • 1 minute(s) read

Generating Custom Properties with a Script

Use the method Add for Properties to create custom properties of data sets, of groups, and of channels and to assign values to these custom properties. For example, to generate a custom property in a group and to to assign a value to this custom property, complete the following steps:

  1. Open the DIAdem NAVIGATOR.

  2. Drag and drop any data set from the file browser into the Data Portal.

  3. Select DIAdem SCRIPT.

  4. Select File»New»VBS Script to create a new script.

  5. Enter or copy the following text into the script editor:

    VBScriptPython

     

    Dim MyPropName, MyPropValue, oMyGroupProperties, oMyGroupProperty
    MyPropName = "My new group property"
    MyPropValue = "My new group property value"
    Set oMyGroupProperties = Data.Root.ChannelGroups(1).Properties
    Set oMyGroupProperty = oMyGroupProperties.Add(MyPropName,MyPropValue,DataTypeString)
    If oMyGroupProperty.Name <> MyPropName Then
      Call MsgboxDisp ("Name was not valid and was changed to: " & oMyGroupProperty.Name)
    End If
  6. Select Script»Run VBS Script to start the script.

  7. Select the first channel group in the Data Portal. DIAdem displays the new custom property with the assigned value in the properties window of the Data Portal.

Log in to get a better experience