DADiSP Worksheet Functions > Function Categories > ActiveX > Automation Server > GETVARIANTDATA
Retrieves data from a command, Window or variable as a variant of a specified type from DADiSP’s ActiveX Automation Server.
[out] VARIANT result = GetVariantData( |
[in] BSTR "command", |
"command" |
- |
A string, a command or Window or variable name. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type |
- |
Optional. An integer, the amplitude correction flag:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
vtype |
- |
Optional. An integer. Specifies the type when converting to a Variant. Only valid if type is 12 (Variant). Defaults to 5 (double). Valid types are the same as above. |
A variant, either a string, scalar or array.
Visual Basic Example:
Dim DADiSP as Object
Dim Result1 as Variant
Dim Result2 as Variant
Dim Result3 as Variant
’’’ Connect to DADiSP
Set DADiSP = CreateObject("dadisp.application")
’’’ Create a 2 Window Worksheet without prompting
Call DADiSP.Execute("newworksheet(2, 0)")
’’’ Generate random data in W1
Call DADiSP.Execute("W1: grand(1000, 1)")
’’’ get version
Result1 = DADiSP.GetVariantData("version", 8)
’’’ get integral of W1
Result2 = DADiSP.GetVariantData("integ(W1)", 2)
’’’ get integral of W1
Result3 = DADiSP.GetVariantData("integ(W1)", 12, 2)
’’’ show it
DADiSP.Visible = 1
Starts DADiSP as an ActiveX Automation server, creates a 2 Window Worksheet and places 1000 random samples in W1. The variant Result1 is a string containing the current version number of DADiSP. The variant Result2 is an 1000x1 integer array containing the integration of the random data rounded to the nearest integer value. The variant Result3 is a 1000x1 variant array where each variant contains an integer.
Visual Basic Example:
Dim DADiSP as Object
Dim Result as Variant
’’’ Connect to DADiSP
Set DADiSP = CreateObject("dadisp.application")
’’’ Create a 2 Window Worksheet without prompting
Call DADiSP.Execute("newworksheet(2, 0)")
’’’ today’s date as a Julian integer
Call DADiSP.Execute("now = julstr(getdate)")
‘’’ Generate date data in W1
Call DADiSP.Execute("W1: now..1..(now+10);setvunits(‘daily’)")
’’’ get date data
Result = DADiSP.GetVariantData("W1")
Starts DADiSP as an ActiveX Automation server, creates a 2 Window Worksheet and places 10 date values in W1. The variant Result is a 10x1 variant array where each variant contains a date (VT_DATE) value.
Because the type parameter was not specified, the returned variant array defaults to the type of series, in this case an array of variants containing date values.
Any DADiSP command can be executed or the contents of any Window or variable can be retrieved.
Use GetVariantData when the data must be returned as a variant of a particular type. If the input is a series and the type is not specified, GetVariantData returns an array of variants. This is equivalent to GetVariantData(series, 12). As indicated in the second example, an array of variants is the best format to return series that contain time and/or date values.
See GETDATA to return variant data where the variant type is automatically determined by the data.
See GETSERIES to explicitly return a SafeArray.
See CASTVARIANTARRAY to explicitly return a series as an array of variants.