With ‘Query Variables’, Scense is able to involve external data sources in all runtime objects.
These variables behave like any other variable and can be used in all situations other variables can be used, including conditions.
With Query Variables the name of the variable will tell Scense what to do to retrieve a value that should be used as a replacement for the variable.
Query Variables use ‘providers’ where each provider may have a different syntax.
Common Query Variable’s name syntax:
The ‘Registry’ provider enables you to query a value from the registry and return this value as the replacement-value for the variable.
The Registry provider does not need a source specification in the name of the variable.
At runtime the above variable will be replaced by the value found in the registry at this location:
Which may be something like: “Windows 8.1 Pro”
The last part of the registry path is always treated as the value name. if you mean to specify the default value of a registry key, please prefix ‘(Default)’ as the name of the value.
The ‘OLEDB’ provider enables you to query all data sources supported by OLEDB including most databases and the active directory, depending on the installed OLEDB providers.
A Query Variable using the OLEDB provider needs both the Source Specification and the Query Specification.
In the above example the source specification (in red) is the OLEDB connection string and the query specification (in green) is the SQL query.
The SQL query should be created carefully because the variable can return only one value. This will be the first column in the first row of the result dataset.
The above query will return all application names in the Scense database, but only the first one will be returned through the variable, e.g. ‘Scense Explorer’
To demonstrate the potential of the OLEDB provider we added another example:
The above example will query the active directory for the name of the domain.
The ‘WMI’ provider enables you to query all available classes of the management interfaces.
A Query Variable using the WMI provider needs both the Source Specification and the Query Specification.
In the above example the source specification (in red) is the WMI provider string and the query specification (in green) is the WMI query.
Just like the OLEDB provider, the WMI provider will also return just one value.
The above query will return the current build number for the current computer.
The ‘UserInput’ provider enables you to retrieve free-text answers from a user using an input box.
A Query Variable using the UserInput provider needs the Source Specification and multiple Query Specifications.
In the above example the source specification (in red) is the question and the query specification (in green) are the optional dialog parameters ‘Title’ and ‘Default value’.
If a default value is specified then this value will already be filled in when the user is presented with the input box.
The above query will return whatever the user types in the input box.