CALCULATE

Purpose:

Evaluates a command string in DADiSP’s ActiveX Automation Server and returns the result as a variant.

Syntax:

[out] VARIANT result = Calculate(

[in] BSTR "command", [in] VARIANT arg1, [in] VARIANT arg2, …, [in] VARIANT argN))

"command"

-

A string, any valid expression.

argN

-

Optional, zero or more variant input arguments.

Returns:

A variant. The result of the calculation if any.

Example:

Visual Basic Example:

 

Dim DADiSP as Object

Dim val as Variant

 

’’’ Connect to DADiSP

Set DADiSP = CreateObject("dadisp.application")

 

’’’ Create a 2 Window Worksheet without prompting

Call DADiSP.Execute("Newworksheet(2, 0)")

 

’’’ Generate 10x3 random array, return result as a variant

val = DADiSP.Calculate("rand", 10, 3)

 

 

Starts DADiSP as an ActiveX Automation server, creates a 2 Window Worksheet, returns a 10x3 random array by processing the input arguments.

Example:

Visual Basic Example:

 

Dim DADiSP as Object

 

’’’ Connect to DADiSP

Set DADiSP = CreateObject("dadisp.application")

 

’’’ Create a 2 Window Worksheet without prompting

Call DADiSP.Execute("Newworksheet(2, 0)")

 

’’’ Generate 100 point random series with formula

Call DADiSP.Calculate("W1 := gnorm", 100, 1)

 

 

Starts DADiSP as an ActiveX Automation server, creates a 2 Window Worksheet and places a 100 point random series in W1 with a formula.

Example:

Visual Basic Example:

 

Dim DADiSP as Object

 

’’’ Connect to DADiSP

Set DADiSP = CreateObject("dadisp.application")

 

’’’ Create a 2 Window Worksheet without prompting

Call DADiSP.Execute("Newworksheet(2, 0)")

 

’’’ Generate a scaled 100 point random series with formula

Call DADiSP.Calculate("W1 := gnorm($1, 1)*$2", 100, 10)

 

 

Starts DADiSP as an ActiveX Automation server, creates a 2 Window Worksheet and places a 100 point random series in W1 scaled by 10 with a formula. The positions of the input arguments are specified by the placeholder variables $1 and $2.

Remarks:

Any DADiSP command can be executed. Multiple statements are separated by semicolons.

 

CALCULATE accepts a variable number of input arguments, evaluates the command string and returns the result (if any) as a variant.

 

The position of the input arguments in the DADiSP command string can be specified by the placeholder variables $1, $2, …, $N, where N is the Nth argument in the optional list.

 

See EXECUTE to evaluate a command string in the current Worksheet without returning the result.

 

See GETDATA to return data from a command, Window or variable.

See Also:

EVAL

EVALUATE

EXECUTE

GETDATA

GETSERIES

PUTDATA

PUTSERIES

QUIT