COMPUTE Property (DATATABLE)


10.5, PLBCMP GUI Only

 

The COMPUTE property specifies a string expression that initializes a column when an AddRow method is executed for a DATATABLE. The property uses the following format:

 

COMPUTE={string}

Note the following:

  1. The COMPUTE property may be used in GETPROP or SETPROP statements of an element of DATATABLE Columns collection.

  2. The {string} is a Character String Variable or literal that specifies an expression for a column and is only executed if the AddRow method does not specify input data.

  3. The {string} expression operators are defined as follows:

  4.  

    Operator

    The value computed is ...

    Default (<str>)

    a simple string or a string that has a format dependent on the column's DATATYPE and CONTENTTYPE. Examples are:

    DEFAULT(1) - Simple value of '1'

    DEFAULT(some) - Simple value of 'some'

    CURDATE

    the current date formatted as 'YYYY-MM-DD'.

    CURTIME

    the current time formatted as 'hh:mm:ss'.

    CURDATETIME

    the current date and time formatted as 'YYYY-MM-DDThh:mm'.

    IDENTITY

    an automatically incrementing identification counter.

    TODAY

    todays date formatted as 'YYYY-MM-DD'

Examples:

 

 

SETPROP

DT.columns("Col7"),*Title="COMPUTE":

 

 

*WebWidth="120px", *ALIGNMENT=$CENTER:

 

 

*DataType=$CDT_DATETM:

 

 

*ContentType=$TC_EDITABLE:

 

 

COMPUTE="CURDATETIME"

 

See https://www.w3schools.com/jsref/prop_datetime-local_value.asp

 

 

 

SETPROP

DT.columns("Col7"),*Title="COMPUTE":

  

 

*WebWidth="120px", *ALIGNMENT=$CENTER:

 

 

*DataType=$CDT_DATE:

 

 

*ContentType=$TC_EDITABLE:

 

 

COMPUTE="CURDATE"

 

See https://www.w3schools.com/jsref/prop_date_value.asp

 

 

SETPROP

DT.columns("Col7"),*Title="COMPUTE":

 

 

*WebWidth="120px", *ALIGNMENT=$CENTER:

 

 

COMPUTE="DEFAULT(1965-09-20)"

 

 

 

SETPROP

DT.columns("Col7"),*Title="COMPUTE":

 

 

*WebWidth="120px", *ALIGNMENT=$CENTER:

 

 

*DataType=$CDT_DATE:

 

 

*ContentType=$TC_EDITABLE:

 

 

COMPUTE="DEFAULT(1965-09-20)"

 

 

 

SETPROP

DT.columns("Col7"),*Title="COMPUTE":

 

 

*WebWidth="120px", *ALIGNMENT=$CENTER:

 

 

*DataType=$CDT_DATE:

 

 

*ContentType=$TC_EDITABLE:

 

 

COMPUTE="TODAY"

 

 

See Also: Object Properties, Object IO Instructions, Object Definitions

 



PL/B Language Reference COMBOSTYLE Property CONTENTTYPE Property (DATATABLE)