Method: Add for ContextParameters
- Updated2024-09-12
- 2 minute(s) read
DIAdem NAVIGATOR > Methods > Method: Add for ContextParameters
Method: Add for ContextParameters
Adds a context parameter to the collection of context parameters.
Set oContextParameter = Object.Add(Name, Value, DataType)
| Object | ContextParameters Object with this method | ||||||||||||||||||||||||||||||||||||||||||
| Name | String Specifies the name of the context parameter. | ||||||||||||||||||||||||||||||||||||||||||
| Value | Variant Specifies the name of the context parameter. | ||||||||||||||||||||||||||||||||||||||||||
| DataType | Specifies the data type of the context parameter. Enumeration with the following selection terms:
| ||||||||||||||||||||||||||||||||||||||||||
| oContextParameter | ContextParameter Returned object |
The following example generates several context parameters and writes these parameters to an ASAM server:
| VBScript | Python |
Dim oMyDataStore Set oMyDataStore = Navigator.ConnectDataStore("MyASAMServer") 'Generating parameter set Dim oMyParameterSet Set oMyParameterSet = Navigator.Settings.CreateContextParameterSet oMyParameterSet.Name = "MyParameterSet" 'Generating parameters and writing parameters into parameter set Dim OMyParameters Set oMyParameters = oMyParameterSet.Parameters Call oMyParameters.Add("DoubleParameter",1.2345,DataTypeFloat64) Call oMyParameters.Add("StringParameter","Parameter",DataTypeString) 'Reading all parameters from parameter set Dim MyParameter For Each MyParameter in oMyParameterSet.Parameters Call MsgBoxDisp("Name: " & MyParameter.Name & VBCrLf _ & "Value: " & MyParameter.Value & VBCrLf _ & "Data type: " & MyParameter.DataType) Next 'Saving, removing and loading parameter set Call Navigator.Settings.SaveContextParameterSet("d:\MyParameterSet.tdp",oMyParameterSet) oMyParameterSet.Parameters.RemoveAll Set oMyParameterSet = Navigator.Settings.LoadContextParameterSet("d:\MyParameterSet.tdp") 'Writing parameter set to server Dim oContext Set oContext = oMyDataStore.GetContext Call oContext.SetParameters(oMyParameterSet) 'Writing another single parameter to server Call oContext.SetParameter("AnotherParam","ParamValue",DataTypeString) 'Reading single parameter from server Dim MyValue MyValue = oContext.GetParameter("AnotherParam")