RowsDiscard  SaveAs

Chapter 9: Methods for the DataWindow Control

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).

Syntax

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.

Returns

Returns 1 if it succeeds and -1 if an error occurs. If any argument’s value is NULL, 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, PocketBuilder 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.

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:

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

Examples

Example 1

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





Copyright © 2004. Sybase Inc. All rights reserved. SaveAs

View this book as PDF