Curve::Attach

Description

Attach an Origin C Curve object to an internal Origin Y data set and its associated X data set.

Attach an Origin C Curve object to internal Origin X and Y data sets.

Attach an Origin C Curve object to internal Origin X and Y data sets.

Attach an Origin C Curve object to internal Origin X and Y datasets.

Attach a Dataset object to a worksheet column identified by worksheet name and column number.

Attach a Dataset object to a worksheet column identified by a Column object.

Syntax

BOOL Attach( LPCSTR lpcszYData )

BOOL Attach( LPCSTR lpcszXData, LPCSTR lpcszYData )

BOOL Attach( Worksheet & wks, int nColX, int nColY )

BOOL Attach( Worksheet & wks, int nColY )

BOOL Attach( LPCSTR lpcszWksName, int nCol )

BOOL Attach( Column & col )

Parameters

lpcszYData
[input] Name of Y Dataset

lpcszXData
[input] Name of X Dataset
lpcszYData
[input] Name of Y Dataset

wks
[input] Origin C Dataset object attached to an internal Origin worksheet
nColX
[input] 0 based offset or column number of X column (data set)
nColY
[input] 0 based offset or column number of Y column (data set)

wks
[input] Origin C Dataset object attached to an internal Origin worksheet
nColY
[input] 0 based offset or column number of Y column (data set)

lpcszWksName
[input] Name of worksheet in which column resides
nCol
[input] Origin C column number to attach to (nCol=1 attaches to second column in worksheet)

col
[input] Origin C column object attached to an Origin worksheet column

Return

Returns TRUE on successful exit and FALSE on error.


Returns TRUE on successful exit and FALSE on error.


Returns TRUE on successful exit and FALSE on error.


Returns TRUE on successful exit and FALSE on error.


Returns TRUE on successful exit and FALSE on error.


Returns TRUE on successful exit and FALSE on error.

Examples

EX1

int Curve_Attach_ex1(string dsName = "Book1_B")
{
    // Assumes Book1_B exists and contains data
    Curve crv;               // Declare Curve object
    crv.Attach( dsName );    // Attach to Y data set by name
    crv.Sort();              // Does effect Book1_B
    return 0;
}


EX2

int Curve_Attach_ex2(string dsXName = "Book1_A", string dsYName = "Book1_B")
{
    // Assumes Book1_A and Book1_B exist and contain data
    Curve crv;                          // Declare Curve object
    crv.Attach( dsXName, dsYName );     // Attach Curve object to X and Y data sets by name
    crv.Sort();                         // Does effect datasets Book1_A and Book1_B
    return 0;
}


EX3

int Curve_Attach_ex3(string wksName1 = "Book1")
{
    // Assumes Book1_A and Book1_B exist and contain data
    Worksheet wks(wksName1);
    Curve crv; 
    crv.Attach( wks, 0, 1 ); // Book1 worksheet and columns 1 (X) and 2 (Y)
    crv.Sort();              // Does affect columns 1 and 2 in wks
    return 0;
}


EX4

int Curve_Attach_ex4(string wksName1 = "Book1")
{
    // Assumes Book1_A and Book1_B exist and contain data
    Worksheet wks(wksName1);
    Curve crv; 
    crv.Attach( wks, 1 ); // Book1 worksheet and column 2 (Y)
    crv.Sort();           // Does affect columns 1 and 2 in wks
    return 0;
}


EX5

int Curve_Attach_ex5(string wksName = "Book1")
{
    // Datasets Book1_A and Book1_B must exist prior to execution
    Curve    crv;               // Create unattached Curve object
    if(crv.Attach(wksName,0))   // Attach Dataset object to first column in Book1 worksheet
    {
        crv.SetSize(10);
        for(int ii = 0; ii < 10; ii++)
            crv[ii] = ii;
    }
    if(crv.Attach(wksName,1)) // Attaching to different dataset detaches from previous dataset 
    {                         // and attaches to new one
        crv.SetSize(10);
        for(int ii = 0; ii < 10; ii++)
            crv[ii] = -ii;
    }
    return 0;
}


EX6

void Curve_Attach_ex6()
{
    // Worksheet columns Book1_A and Book1_B must exist prior to execution
    Column colB("Book1",1);    // Create an Origin C Column object attached to the second column
                               // in the Origin worksheet Book1
    Curve    crv;              // Create unattached Dataset object
    crv.Attach(colB);          // Attach Dataset object to first column in Data1 worksheet
}

Remark

Attach an Origin C Dataset object to an Origin worksheet column identified by an Origin C Column object. Origin C Dataset objects must be attached to internal Origin data sets either by constructor or by the Attach method.

See Also

Column::Column, Curve::Curve, Curve::Detach, DataRange::GetData, DataRange::GetMaskedData, DataRange::GetMissingData, DataRange::GetNumData, Dataset::Dataset, Dataset::Detach

header to Include

origin.h