AddRow Method (DATATABLE)


10.5, PLBCMP GUI Only

 

The AddRow method inserts a new row into a DATATABLE. The method uses the following format:

 

[label]

{object}.AddRow

[GIVING {return}] USING [*Text=]{text}

 

 

[*Row=]{row}][:

 

 

[*Param=]{param}][:

 

 

[*Checked=]{checked}][:

 

 

[*Selected=]{selected}][:

 

 

[*Context=]{context}][:

 

 

[*SubItem1=]{stext}][:

 

 

[*SubItem2=]{stext}][:

 

 

...

 

 

[*SubItem40=]{stext}]

 

Where:

label

Optional. A Program Execution Label.

object

Required. A DATATABLE object to which a row is added.

return

Optional. A Numeric Variable that returns the zero-based row number if successful or -1 if the method fails.

text

Required. A Character String Variable or literal that specifies text associated with the new row.

row

Optional. A Numeric Variable or decimal number that specifies the new row's zero-based number.

param

Optional. A Numeric Variable or decimal number that specifies the user-defined value associated with the new row.

checked

Optional. A Numeric Variable or decimal number that specifies the initial row checkbox state.

selected

Optional. A Numeric Variable or decimal number that specifies whether the row should initially be selected.

context

Optional. A Numeric Variable or decimal number that specifies the initial row context appearance.

stext

Optional. A Character String Variable or literal that specifies text assigned to a subitem in the new row.

Flags Affected: EOS, OVER, ZERO

Note the following:

  1. The EOS flag is always cleared.

  2. The ZERO flag is set if the {return} value is zero.

  3. The OVER flag is set if the {return} variable is too small to receive the value.

  4. If a {row} is not specified, the default value is zero (0) causing all rows to be pushed down.

  5. If the DATATABLE is sorted ascending or descending, the data is sorted when the new row is added.

  6. The row context type values are defined as follows:

  7.  

    Value

    Keyword

    0

    $OC_DEFAULT

    1

    $OC_DANGER

    2

    $OC_DARK

    3

    $OC_INFO

    4

    $OC_LIGHT

    5

    $OC_PRIMARY

    6

    $OC_SECONDARY

    7

    $OC_SUCCESS

    8

    $OC_WARNING

     

  8. The ROWS collection allows direct access to a DATATABLE row using the GETPROP or SETPROP statements. The collection uses the following format:

  9.  

         [label] GetProp {object}.Rows({key}),{property}

    Where:

    label
    Optional. A Program Execution Label.
    object
    Required. A DATATABLE object that is accessed.
    key
    Required. A decimal number or Numeric Variable that specifies a zero-based position of a row.
    property
    Required. The remaining line of the statement consist of row properties found in the Row Properties (DATATABLE) section.

    Example for DATATABLE Row properties using the ROWS collection:

     

    Table1

    DATATABLE

     

    .

     

     

     

    CREATE

    Table1

     

    ...

     

    . Add columns as required by the application

     

    ...

     

     

    Table1.AddColumn

    using 0 //Column 0 - Order Id

     

    Table1.AddColumn

    using 1 //Column 1 - Order Time

     

    ...

     

    . Change the properties for the DataTable Columns

    .

     

     

     See the DATATABLE 'AddColumn' Method.

     

    ...

     

    . Add Rows as required by the application

    .

     

     

     

    Table1.AddRow

    using *Text=OrderId0: //String text

     

     

    *subitem1=OrderTime0

    .

     

     

     

    Table1.AddRow

    using *Text=NextId1: //String text

     

     

    *subitem1=OrderTime1

     

    ...

     

     

    SETPROP

    Table1.rows(0), *Selected=$OFF

    .

     

     

     

    SETPROP

    Table1.rows(1), *Selected=$ON //Select row 1

 

 

See Also: Method Syntax, DATATABLE Methods

 



PL/B Language Reference AddColumn Method (DATATABLE) Commit Method (DATATABLE)