DIAdem Help

Method: AddReference for Elements <DataStore>

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

Method: AddReference for Elements <DataStore>

Adds an already existing element to a collection of elements, in a data store.

Note  The AddReference method is not supported by the property RootElements of the DataStore object.

Set oElement = Object.AddReference(Instance, SetInvers)
ObjectElements <DataStore>
Object with this method
InstanceElement <DataStore>
Specifies the element to be added.
SetInversVariant
Specifies whether the AddReference method sets the inverse reference. If the value is FALSE, the AddReference method does not set the inverse reference, even if the inverse reference is defined in the data model.If the value is TRUE , or the parameter is missing, the AddReference method sets the inverse reference.
oElementElement <DataStore>
Returned object

The following example removes a reference from a measurement quantity and adds this reference to a different measurement quantity:

VBScriptPython

 

Dim oMyDataStore, oMyElement, oMyMeaQuantity 
Set oMyDataStore = Navigator.ConnectDataStore("ASAM Browse Settings Example")
Set oMyElement = oMyDataStore.RootElements("MyRootElement").Children("MyFirstChildren").Children("MySecondChildren") 
Set oMyMeaQuantity = oMyElement.Children("MyThirdChildren").Children(1)
Call oMyElement.Children("MyThirdChildren").Children.RemoveReference(oMyMeaQuantity)
Call oMyElement.Children("MyFourthChildren").Children.AddReference(oMyMeaQuantity, TRUE)