GetItemTime

Description

Gets data whose type is Time from the specified buffer of a DataWindow control or DataStore object. You can obtain the data that was originally retrieved and stored in the database from the original buffer, as well as the current value in the primary, delete, or filter buffers.

Applies to

DataWindow type

Method applies to

PowerBuilder

DataWindow control, DataWindowChild object, DataStore object


Syntax

PowerBuilder

time dwcontrol.GetItemTime ( long row, string column {, DWBuffer dwbuffer, boolean originalvalue } )
time dwcontrol.GetItemTime ( long row, integer column {, DWBuffer dwbuffer, boolean originalvalue } )

Argument

Description

dwcontrol

A reference to a DataWindow control, DataStore, or child DataWindow.

row

A value identifying the row location of the data.

column

The column location of the data. The datatype of the column must be time. Column can be a column number or a column name. The column number is the number of the column as it is listed in the Column Specification view of the DataWindow painter -- not necessarily the number of the column in the Design view.

To get the contents of a computed field, specify the name of the computed field for column. Computed fields do not have numbers.

dwbuffer (optional)

A value of the dwBuffer enumerated datatype identifying the DataWindow buffer from which you want to get the data. For a list of valid values, see DWBuffer.

originalvalue (optional)

A boolean indicating whether you want the original or current values for row and column:

  • True -- Return the original values (the values initially retrieved from the database).

  • False -- (Default) Return the current values.

If you specify dwbuffer, you must also specify originalvalue.


Return value

Returns the time value in the specified row and column. Returns null if the column value is null or if there is no DataWindow object assigned to the DataWindow control or DataStore. Returns 00:00:00.000000 if an error occurs.

If any argument value is null, in PowerBuilder the method returns null.

Usage

Use GetItemTime to get information from the DataWindow's buffers. To find out what the user entered in the current column before that data is accepted, use GetText. In the ItemChanged or ItemError events, use the data argument.

To access a row in the original buffer, specify the buffer that the row currently occupies (primary, delete, or filter) and the number of the row in that buffer. When you specify true for originalvalue, the method gets the original data for that row from the original buffer.

Datatypes of columns and computed fields

An execution error occurs when the datatype of the DataWindow column does not match the datatype of the method -- in this case, time.

There is a difference in datatypes between computed columns retrieved from the database and computed fields defined in the DataWindow painter. Computed columns from the database can have a datatype of time, but a time computed field always has a datatype of DateTime, not time. Use the GetItemDateTime method instead.

PowerBuilder only: using GetItemTime in a String function

When you call GetItemTime as an argument for the String function and do not specify a display format, the value is formatted as a DateTime value. This statement returns a string like "2/26/06 00:00:00":

String(dw_1.GetItemTime(1, "start_date"))

To get a simple time string, you can specify a display format for the String function or you can assign the value to a time variable before calling the String function (see GetItemDate for examples).

Examples

These statements set Start to the current Time data in the primary buffer for row 3 of the column named title in dw_employee:

Time Start
Start = dw_employee.GetItemTime(3, "title")

These statements set Start to the current Time data in the filter buffer for row 3 of the column named start_time of dw_employee:

Time Start
Start = dw_employee.GetItemTime(3, "start_time", Filter!, false)

These statements set Start to the original Time data in the primary buffer for row 3 of the column named start_time of dw_employee:

Time Start
Start = dw_employee.GetItemTime(3, "start_time", Primary!, true)

See also

GetItemDate

GetItemDateTime

GetItemDecimal

GetItemNumber

GetItemString

GetText

SetItem

SetText