com.ibm.openpages.api.application

## Interface ICognosReportRow

- All Superinterfaces:
    java.lang.Iterable<ICognosReportColumnValue>

      public interface ICognosReportRow
      extends java.lang.Iterable<ICognosReportColumnValue>

  A row of data from a Cognos report output which contains one or more ICognosReportColumnValue items for each returned column. There are two patterns for consuming values from each row. Rows are iterable and columns are retrievable by name or index. 1) Consume the row as a java.lang.Iterable of ICognosReportColumnValue objects.

       	//iterate over the row values
       	for (ICognosReportColumnValue columnValue : iCognosReportRow) {
       		System.out.print(columnValue.getColumnName()+": " + columnValue.getValue()+", ");
       	}

  2) Retrieve columns individually by name or index.

       {
           @code
           BigDecimal userid = (BigDecimal) iCognosReportRow.getColumnValue(0).getValue();
           String username = (String) iCognosReportRow.getColumnValue(1).getValue();
           Short enabled = (Short) iCognosReportRow.getColumnValue(2).getValue();

           System.out.println("userid: " + userid + ", username: " + username + ", isenabled: " + enabled);
       }

  The `ICognosReportColumnValue.getValue()` method returns an object whose type is determined by the data type contained in the report metadata for that column. You can cast to the appropriate type.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `ICognosReportColumnValue` | `getColumnValue(int columnIndex)` Returns the column value for the specified column.
    `ICognosReportColumnValue` | `getColumnValueByName(java.lang.String columnName)` Returns the column value for the specified column name.

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, iterator, spliterator`

- - ### Method Detail

    - #### getColumnValueByName

          ICognosReportColumnValue getColumnValueByName(java.lang.String columnName)

      Returns the column value for the specified column name. Column names are determined by the Query data item names in your report. You can refer to the output metadata to find the column names in the output. See `ICognosReportRowReader.getOutputMetaData()` for more information.
      Parameters:
        `columnName` - (required) name of the column from the Cognos report output
      Returns:
        ICognosReportColumnValue for this column

    - #### getColumnValue

          ICognosReportColumnValue getColumnValue(int columnIndex)

      Returns the column value for the specified column. The index starts from 0 for first column in the row.
      Parameters:
        `columnIndex` - (required) index of the column from the Cognos report output
      Returns:
        ICognosReportColumnValue for specified column

Licensed Materials - Property of IBM
OpenPages with Watson (PID: 5725-D51)
© Copyright IBM Corporation 2013, 2022. All Rights Reserved.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.