Project::GetDataObject

Description

Creates a DataObject& from DataObject name. Can be used to get a DateObject& from related DataObject name(Example2).

Syntax

DataObject & GetDataObject( LPCSTR name )

Parameters

name
[input]name of the DataObject

Return

A refernce to DataObject (A MatrixObject or Column), if invalid name -- the object is invalid

Examples

EX1

//Get all the Dataset name from the worksheet and matrix in the Project.
void Project_GetDataObject_Ex1()
{
   foreach (string strDatasetName in Project.DatasetNames)
   {
      DataObject& obj = Project.GetDataObject(strDatasetName);
      if(obj.IsValid())
      {
           printf("Dataset %s  in some wks/matrix\n", strDatasetName);
      }
      else
      {
           printf("Dataset %s is not in any wks/matrix\n", strDatasetName);
      }
   }
}

EX2

void Project_GetDataObject_Ex2()
{
    string strCurveName = Project.ActiveCurve().GetName();
    DataObject& obj = Project.GetDataObject(strCurveName);
    
    if(obj != NULL)
    {
        Column cc = obj;
        if(cc)
        out_int("Col Index = ", cc.GetIndex());
    }
}

Remark

See Also

Project::GetObject

header to Include

origin.h