RowsMove

Description

Clears a range of rows from one DataWindow control (or DataStore) and inserts them in another. Alternatively, RowsMove moves rows from one buffer to another within a single DataWindow control (or DataStore).

Applies to

DataWindow type

Method applies to

PowerBuilder

DataWindow control, DataWindowChild object, DataStore object


Syntax

PowerBuilder

integer dwcontrol.RowsMove ( long startrow, long endrow, 
   DWBuffer movebuffer, datawindow targetdw, long beforerow,
   DWBuffer targetbuffer )
integer dwcontrol.RowsMove ( long startrow, long endrow,
   DWBuffer movebuffer, datastore targetdw, long beforerow,
   DWBuffer targetbuffer )
integer dwcontrol.RowsMove ( long startrow, long endrow, 
   DWBuffer movebuffer, datawindowchild targetdw, 
   long beforerow, DWBuffer targetbuffer )

Argument

Description

dwcontrol

The name of a DataWindow control, DataStore, or child DataWindow from which you want to move rows.

startrow

The number of the first row you want to move.

endrow

The number of the last row you want to move.

movebuffer

A value of the dwBuffer enumerated datatype identifying the DataWindow buffer from which you want to move the rows.

For a list of valid values, see DWBuffer.

targetdw

The name of the DataWindow control or DataStore to which you want to move the rows. Targetdw can be the same DataWindow control (or DataStore) or a different DataWindow control (or DataStore), but it cannot be a child DataWindow.

beforerow

The number of the row before which you want to insert the moved rows. To insert after the last row, use any value that is greater than the number of existing rows.

targetbuffer

A value of the dwBuffer enumerated datatype identifying the target buffer for the rows.

For a list of valid values, see DWBuffer.


Return value

Returns 1 if it succeeds and -1 if an error occurs.

If any argument's value is null, in PowerBuilder and JavaScript the method returns null.

Usage

When you use RowsMove, the rows have the status NewModified! in the target DataWindow.

If you move rows between buffers in a single DataWindow control or DataStore, PowerBuilder retains knowledge of where the rows came from, and their status is changed accordingly. For example, if you move unmodified rows from the primary buffer to the delete buffer, they are marked for deletion. If you move the rows back to the primary buffer, their status returns to NotModified!. Note, however, that if you move rows from one DataWindow control (or DataStore) to another and back again, the rows' status is NewModified! because they came from a different DataWindow.

The RowsMove method triggers the RowFocusChanging and RowFocusChanged events only when the row number of the current row is changed. The current row is simply a number that indicates which row is the current row. A change in the content of the row does not trigger the events if the number of the current row remains the same.

Suppose you have a DataWindow with two rows. If the current row is row 1 and RowsMove moves row 1, row 2 becomes the current row, but its row number also changes from 2 to 1. The events are not fired because the current row number is still row 1. If the current row is row 2 and RowsMove moves row 1, the events are fired because the current row number has changed from row 2 to row 1.

When you use RowsMove, data is not automatically retrieved for drop-down DataWindows in the target DataWindow, as it is when you call InsertRow. You must explicitly call Retrieve for child DataWindows in the target.

When you use RowsCopy or RowsMove to populate another DataWindow, the copied data is not automatically processed by filters or sort criteria in effect on the target DataWindow. You might be required to call the Filter, GroupCalc, or Sort methods to properly process the data.

Uses for RowsMove include:

  • Moving several rows from the primary buffer to the delete buffer, instead of deleting them one at a time

  • Moving rows from the delete buffer to the primary buffer, to implement an Undo capability in your application

Buffer manipulation and query mode

A DataWindow cannot be in query mode when you call the RowsMove method.

Examples

This statement moves all the rows starting with the first row in the delete buffer for dw_1 to the primary buffer for dw_1, thereby undeleting these rows:

dw_1.RowsMove(1, dw_1.DeletedCount(), Delete!, &
      dw_1, 1, Primary!)

See also

RowsCopy

RowsDiscard