AddColumn Method (DATATABLE)


10.5, PLBCMP GUI Only

 

The AddColumn method inserts a new column into a DATATABLE. The method uses the following format:

 

[label]

{object}.AddColumn

[GIVING {return}] USING [*Pos=]{position}

 

 

[*ContentType=]{type}][:

 

 

[*Id=]{id}]

 

Where:

label

Optional. A Program Execution Label.

object

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

return

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

position

Required. A Numeric Variable or decimal number that specifies the zero-based new column position.

type

Optional. A Numeric Variable or decimal number that specifies the type of data stored in the column.

id

Optional. A Character String Variable or literal that specifies identification name assigned to the new column.

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. The column content type values are defined as follows:

  5.  

    Value

    Keyword

    Description

    0

    $TC_DEFAULT

    DefaultT

    1

    $TC_HIDDEN

    Hidden

    2

    $TC_EDITABLE

    Editable LISTVIEW mode

    3

    $TC_TITLE

    Title

    4

    $TC_DETAILS

    Details

    5

    $TC_IMAGE

    Image

    6

    $TC_HEADER

    Header

    7

    $TC_FOOTER

    Footer

    8

    $TC_BUTTON1

    Button 1

    9

    $TC_BUTTON2

    Button 2

    10

    $TC_BUTTON3

    Button 3

    11

    $TC_START

    Start Time

    12

    $TC_END

    End Time

    13

    $TC_GPS

    GPS Address

     

  6. The COLUMNS collection allows access to a DATATABLE column using the GETPROP or SETPROP statements. The collection uses the following format:

  7.  

    [label] GetProp {object}.Columns({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 is zero-based position of the column or a Character String Variable or literal using the 'column identification'. The 'column identification' is defined using the *ID parameter for the 'AddColumn' method.
    property
    Required. The remaining line of the statement consist of column properties found in the 'Column Properties (DATATABLE)' section.

    Example for DATATABLE Column properties using the COLUMNS collection:

     

    Table1

    DATATABLE

     

    .

     

     

     

    CREATE

    Table1

     

    ...

     

     

    Table1.AddColumn

    using 0 //Column 0 - Order Id

     

    Table1.AddColumn

    using 1 //Column 1 - Order Time

     

    ...

     

    . Change the properties for the DataTable Column

    .

     

     

     

    SETPROP

    Table1.columns(0), *Title="Order Id":

     

     

    *WebWidth="40px":

     

     

    *Alignment=$LEFT

    .

     

     

     

    SETPROP

    Table1.columns(1), *Title="Order Time":

     

     

    *WebWidth="120px":

     

     

    *Alignment=$CENTER:

     

     

    *DataType=$CDT_TIME:

     

     

    *ContentType=$TC_EDITABLE:

     

     

    *COMPUTE="CURTIME"

 

 

See Also: Method Syntax, DATATABLE Methods

 



PL/B Language Reference AddRow Method (DATATABLE)