Collection: ContextParameters
- Updated2024-09-12
- 2 minute(s) read
Objects > Navigator > Settings
Collection: ContextParameters
A collection of context parameters. Use the Context.GetParameter method to read context parameters from an ASAM server. Use the Context.SetParameter method to write context parameters to an ASAM server. Use the Context.SetParameters method to write all context parameters of a Parameter set to an ASAM server.
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")