2.2.4.5.51 Column::SetInternalData

Description

Set the column internal data type.

Syntax

BOOL SetInternalData( UINT iType )

Parameters

iType
[input] An FSI_* data type constant defined in oc_const.h

Return

TRUE if set the column internal type successfully, otherwise FALSE.

Examples

EX1

// This example creates a worksheet with four numeric columns with four storage types
void    Column_SetInternalData_Ex1()
{
    Worksheet wks;
    wks.Create("Origin", CREATE_VISIBLE);
    if(!wks)
        return;
    int    iType = FSI_DOUBLE;
    wks.AddCol();
    wks.AddCol();
    foreach(Column col in wks.Columns)
    {
        col.SetFormat(OKCOLTYPE_NUMERIC);    
        if(!col.SetInternalData(iType))
            out_str("set error");
        iType++;
    }
}

EX2

// create new wks with 3 col, and set col(3) as complex
void    Column_SetInternalData_Ex2(int npts = 100)
{
    Worksheet wksOut;
    wksOut.Create();
    // Make sure the worksheet has 2 * nNumData columns (X, Ycomplex for each data):
    while( wksOut.Columns.Count() < 2)
        wksOut.AddCol();
    
    // Initialize XYRange for setting the data into:
    XYRangeComplex dr;
    
    dr.Add("X", wksOut, 0, 0, -1, 0);
    
    // Set the destination column for complex:
    Column            colObj = wksOut.Columns(1);
    colObj.SetFormat(OKCOLTYPE_NUMERIC);
    colObj.SetInternalData(FSI_COMPLEX);
    
    dr.Add("Y", wksOut, 0, 1, -1, 1);
    
    dr.Add("S", NULL);

    
    // Generate some data and set it into the XYRange:
    int    nNumRows = 5;
    vector                vReal;
    vector                vImag;
    vector                vx;
    vReal.SetSize(nNumRows);
    vImag.SetSize(nNumRows);
    vx.SetSize(nNumRows);
    for (int row = 0; row < nNumRows; row++)
    {
        double            rX = row + 1;
        double            rReal = pow(10, 0) + (row + 1);
        double            rImag = 2 * pow(10, 0) + (row + 1) * (row + 1);
        
        vReal[row] = rReal;
        vImag[row] = rImag;
        vx[row] = rX;
    }

    if ( !dr.SetData(&vReal, &vImag, &vx, 0) )
    {
        out_str("Failed to set data.");
    }
}

Remark

Replaced by DataObject::SetInternalDataType

Set the column internal data type (This is a characteristic of numeric

column format). If you are not sure the column is in numeric format, call SetFormat

first.

See Also

Column::GetInternalData

Header to Include

origin.h