Dataset::Dataset

Description

Default constructor for Dataset class.

Constructor to create a Dataset from data set name.

Constructor to create a Dataset from worksheet name and column number.

Copy constructor for Dataset class.

Constructor to create a Dataset from worksheet object and column number.

Constructor to create a Dataset from a Column object.

Syntax

Dataset( )

Dataset( LPCSTR lpcszDatasetName )

Dataset( LPCSTR lpcszWksName, int nCol )

Dataset( Dataset dsOriginal )

Dataset( Worksheet & wks, int nCol )

Dataset( Column & col )

Parameters

lpcszDatasetName
[input] Name of internal Origin data set to which Origin C object is attached

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).

dsOriginal
[input] Origin C Dataset object to copy

wks
[input] Origin C worksheet object attached to an Origin worksheet
nCol
[input] Origin C column number to attach to (nCol=1 attaches to second
column in Origin worksheet).

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

Return

Examples

EX1

void Dataset_Dataset_ex1()
{
    // Worksheet 2nd column  must exist prior to execution
    Worksheet wks;
    wks.Create("origin", CREATE_VISIBLE);
    wks.SetNumRows(50);
    if (wks)
    {
        Dataset dsB;       // Create Origin C Dataset object not attached to an Origin data set 
        dsB.Attach(wks,1); // Attach Origin C Dataset object dsB to Origin data set wks(1)
        dsB.SetSize(5);
        dsB = 1;
    }
    
}


EX2

void Dataset_Dataset_ex2()
{
    // Worksheet 2nd column  must exist prior to execution
    Worksheet wks;
    wks.Create("origin", CREATE_VISIBLE);
    wks.SetNumRows(50);
    if (wks)
    {
        string strWksColname = wks.Columns(1).GetName();
        strWksColname = wks.GetPage().GetName() + "_" + strWksColname;        
        Dataset dsB(strWksColname); // Create an Origin C Dataset object attached to an Origin data set
        dsB.SetSize(5);
        dsB = 2;
    }
    
}


EX3

void Dataset_Dataset_ex3()
{
    // Worksheet 2nd column  must exist prior to execution
    Worksheet wks;
    wks.Create("origin", CREATE_VISIBLE);
    wks.SetNumRows(50);
    if (wks)
    {
        string strWksname = wks.GetPage().GetName();
        Dataset dsB(strWksname,1); // Create an Origin C Dataset object attached to an Origin data set
                                   // contained in column 2 of Origin worksheet 
        dsB.SetSize(5);
        dsB = 3;
    }
    
}


EX4

void Dataset_Dataset_ex4()
{
    // Worksheet 2nd column  must exist prior to execution
    Worksheet wks;
    wks.Create("origin", CREATE_VISIBLE);
    wks.SetNumRows(50);
    if (wks)
    {
        Dataset dsA(wks,0);
    
        int nSize = 3;
        dsA.SetSize(nSize);
        for(int ii=0; ii<nSize; ii++)
        {
            dsA[ii] = ii+1;
        }
    
        Dataset dsB(dsA); // Generates a temporary dataset of size 3 having values 1,2,3
    }
    
}


EX5

void Dataset_Dataset_ex5()
{
    // Worksheet 2nd column  must exist prior to execution
    Worksheet wks;
    wks.Create("origin", CREATE_VISIBLE);
    wks.SetNumRows(50);
    if (wks)
    {
        Dataset dsB(wks,1);  // Create an Origin C Dataset object attached to an Origin data set
                             // contained in column 2 of the Origin worksheet 
        dsB.SetSize(5);
        dsB = 4;
    }
    
}


EX6

void Dataset_Dataset_ex6()
{
    // Worksheet 2nd column  must exist prior to execution
    Worksheet wks;
    wks.Create("origin", CREATE_VISIBLE);
    wks.SetNumRows(50);
    if (wks)
    {
        Column colB(wks,1);    // Create an Origin C Column object attached to the second column
                               // in the Current Origin worksheet 
        Dataset dsB(colB);     // Create an Origin C Dataset object attached to the data set
                               // contained in column 2 of the Current Origin worksheet 
        dsB.SetSize(5);
        dsB = 5;
    }
    
}

Remark

Constructor to create an Origin C Dataset object from an Origin C Column object.

See Also

Column::Column, Dataset::Attach, Dataset::Detach, Worksheet::Worksheet

header to Include

origin.h