DIAdem Help

Content Type
Programming Language
Current manual
Table of Contents

Method: AddProperties for Properties <Data>

Method: AddProperties for Properties <Data>

Adds copies of existing properties to the properties of an element (root, channel group, or channel), in the script interface for internal data.

Object.AddProperties(Properties, Prefix)
ObjectProperties <Data>
Object with this method
PropertiesProperties <Data>
Specifies which properties to copy.
PrefixVariant
Specifies which prefix DIAdem adds in the Data Portal to the name of the copied properties.

Note  If the property with the specified name exists, DIAdem does not overwrite this property but retains the original property including its value.

The following example adds the properties of the first channel group to the properties of the first channel of the second channel group. The example does not overwrite existing properties:

VBScriptPython

 

Dim oMyProperties, oMyChannel
Set oMyProperties = Data.Root.ChannelGroups(1).Properties
Set oMyChannel = Data.Root.ChannelGroups(2).Channels(1)
Call oMyChannel.Properties.AddProperties(oMyProperties)

The following example adds the properties of the first channel group to the properties of the first channel of the second channel group and overwrites any existing properties:

VBScriptPython

 

Dim oMySourceProperties, oMyDestinationChn
Set oMySourceProperties      = Data.Root.ChannelGroups(1).Properties
Set oMyDestinationChn        = Data.Root.ChannelGroups(2).Channels(1)
Call AddOverwriteProperties(oMySourceProperties, oMyDestinationChn)

Sub AddOverwriteProperties(oSourceProperties, oDestinationChn)
  Dim oDestinationProperties, oProperty, PropertyName
  Set oDestinationProperties = oDestinationChn.Properties
  For Each oProperty in oSourceProperties
    PropertyName = oProperty.Name
    If oDestinationProperties.Exists(PropertyName) Then 
      If (oProperty.DataType = oDestinationProperties(PropertyName).DataType) Then 
        Call oDestinationProperties.Add(oProperty.Name, oProperty.Value)
      Else
        Call MsgBox ("Please change the datatype of the property: " & PropertyName)
      End If 
    Else
      Call oDestinationProperties.Add(oProperty.Name, oProperty.Value)
    End If 
  Next
End Sub
In This Section
Was this information helpful?