GetData

Obtains data from a control.

To obtain

Use

The value of a data point in a series in a graph

Syntax 1 For data points in graphs

The unformatted data from an EditMask control

Syntax 2 For EditMask controls

Data from an OLE server

Syntax 3 For data in an OLE server


Syntax 1 For data points in graphs

Description

Gets the value of a data point in a series in a graph.

Applies to

Graph controls in windows and user objects, and graphs in DataWindow controls

Syntax

controlname.GetData ( { graphcontrol, } seriesnumber, datapoint 
  {, datatype } )

Argument

Description

controlname

The name of the graph from which you want data, or the name of the DataWindow control containing the graph.

graphcontrol (DataWindow control only)

(Optional) A string whose value is the name of the graph from which you want the data when controlname is a DataWindow.

seriesnumber

The number that identifies the series from which you want data.

datapoint

The number of the data point for which you want the value.

datatype (scatter graph only)

(Optional) A value of the grDataType enumerated datatype specifying whether you want the x or y value of the data point in a scatter graph. Values are:

  • xValue! — The x value of the data point

  • yValue! — (Default) The y value of the data point

Returns

Double. Returns the value of the data in datapoint if it succeeds and 0 if an error occurs. If any argument’s value is null, GetData returns null.

Usage

You can use GetData only for graphs whose values axis is numeric. For graphs with other types of values axes, use the GetDataValue function instead.

Examples

Example 1

These statements obtain the data value of data point 3 in the series named Costs in the graph gr_computers in the DataWindow control dw_equipment:

integer SeriesNbr

double data_value


// Get the number of the series.

SeriesNbr = &

    dw_equipment.FindSeries("gr_computers", "Costs")

data_value = dw_equipment.GetData( &

    "gr_computers" , SeriesNbr, 3)

Example 2

These statements obtain the data value of the data point under the mouse pointer in the graph gr_prod_data and store it in data_value:

integer SeriesNbr, ItemNbr

double data_value

grObjectType MouseHit


MouseHit = &

    gr_prod_data.ObjectAtPointer(SeriesNbr, ItemNbr)

IF MouseHit = TypeSeries! THEN

    data_value = &

      gr_prod_data.GetData(SeriesNbr, ItemNbr)

END IF

Example 3

These statements obtain the x value of the data point in the scatter graph gr_sales_yr and store it in data_value:

integer SeriesNbr, ItemNbr

double data_value


gr_product_data.ObjectAtPointer(SeriesNbr, ItemNbr)

data_value = &

    gr_sales_yr.GetData(SeriesNbr, ItemNbr, xValue!)

See also


Syntax 2 For EditMask controls

Description

Gets the unformatted text from an EditMask control.

Applies to

EditMask controls

Syntax

editmaskname.GetData ( datavariable )

Argument

Description

editmaskname

The name of the EditMask control containing the data.

datavariable

A variable to which GetData will assign the unformatted data in the EditMask control. The datatype of datavariable must match the datatype of the EditMask control, which you select in the Window painter. Available datatypes are date, DateTime, decimal, double, string, and time.

Returns

Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument’s value is null, GetData returns null.

Usage

You can find out the datatype of an EditMask control by looking at its MaskDataType property, which holds a value of the MaskDataType enumerated datatype.

Examples

Example 4

This example gets data of datatype date from the EditMask control em_date. Formatting characters for the date are ignored. The String function converts the date to a string so it can be assigned to the SingleLineEdit sle_date:

date d

em_date.GetData(d)

sle_date.Text = String(d, "mm-dd-yy")

Example 5

This example gets string data from the EditMask control em_string and assigns the result to sle_string. Characters in the edit mask are ignored:

string s

em_string.GetData(s)

sle_string.Text = s


Syntax 3 For data in an OLE server

Description

Gets data from the OLE server associated with an OLE control using Uniform Data Transfer.

Applies to

OLE controls and OLE custom controls

Syntax

olename.GetData ( clipboardformat, data )

Returns

Integer. Returns 0 if it succeeds and -1 if an error occurs.