public method O2GOrderRow.getCell

Brief

Gets a cell of the table.

Declaration
C#
object  getCell (int column)

Parameters
column

The index of the column. The index should be between 0 and Columns.Count - 1.

Returns

Returns the cell value that can be of different types. To determine a type, it is necessary to get a column by using the O2GGenericTableResponseReader.getColumns and the O2GTableColumnCollection.Item methods. The index passed to the latter method should be the same as the column parameter. The type of value is defined by using the O2GTableColumn.ColumnType method. The O2GTableColumnType enumerator returned by the above method contains the returned value type. A client application can cast object data to the returned type or can use a abstract object.

Column types and cast operations:

Column type

getCell value

O2GTableColumnType.Integer

The method returns a 32-bit integer value.
Cast operation: int value = (int)reader.getCell(columnIndex);

O2GTableColumnType.Double

The method returns a double value.
Cast operation: double value = (double)reader.getCell(column);

O2GTableColumn.Boolean

The method returns a boolean value.
Cast operation: bool value = (bool)reader.getCell(column);

O2GTableColumn.Date

The method returns a date/time value.
Cast operation: DateTime date = (DateTime)reader.getCell(column);

O2GTableColumnType.String

The method returns a string data value.
Cast operation: string value = (string)reader.getCell(column);

Details

The method is used to work with an abstract table. The method provides common access to a row value independently of a row type (a table type).

Print Generic Table [hide]

private void PrintGenericTableInterface(O2GGenericTableResponseReader genericReader)
{
   O2GTableColumnCollection columns = genericReader.Columns;
   for (int i = 0; i < genericReader.Count; i++)
   {
       int iCount = columns.Count;
       O2GRow row = genericReader.getGenericRow(i);
       for (int j = 0; j < iCount; j++)
       {
           object value = row.getCell(j);
           O2GTableColumn column = columns[j];
           switch (column.ColumnType)
           {
           case O2GTableColumnType.Date:
               DateTime date = (DateTime)value;
               Console.WriteLine("{0} {1}", column.ID, date.ToString("yyyy-MM-dd HH:mm"));
           break;
           case O2GTableColumnType.Boolean:
                bool bVal = (bool)value;
                Console.WriteLine("{0} {1}", column.ID, bVal.ToString());
           break;
           case O2GTableColumnType.Integer:
               int iVal = (int)value;
               Console.WriteLine("{0} {1}", column.ID, iVal.ToString());
           break;
           case O2GTableColumnType.Double:
               double dVal = (double)value;
               Console.WriteLine("{0} {1}", column.ID, dVal.ToString());
           break;
           case O2GTableColumnType.String:
               string  sVal = (string)value;
               Console.WriteLine("{0} {1}", column.ID, sVal.ToString());
           break;
           }
       }
    }
}

Declared in O2GRow

back