RowCount  RowsDiscard

Chapter 9: Methods for the DataWindow Control

RowsCopy

Description

Copies a range of rows from one DataWindow control (or DataStore object) to another, or from one buffer to another within a single DataWindow control (or DataStore).

Syntax

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

Argument

Description

dwcontrol

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

startrow

The number of the first row you want to copy.

endrow

The number of the last row you want to copy.

copybuffer

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

For a list of valid values, see DWBuffer.

targetdw

A reference to the DataWindow control or DataStore object to which you want to copy the rows. Targetdw can be the same DataWindow (or DataStore) or another DataWindow (or DataStore).

beforerow

The number of the row before which you want to insert the copied 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 DataWindow buffer for the copied 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 the RowsCopy method, the status of the rows that are copied to the primary buffer is NewModified!. If you issue an update request, PocketBuilder sends SQL INSERT statements to the DBMS for the new rows.

When you use RowsCopy, data is not automatically retrieved for drop-down DataWindows in the target DataWindow or DataStore, 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 RowsCopy include:

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

Examples

Example 1

This statement copies all the rows starting with the current row in dw_1 to the beginning of the primary buffer in dw_2:

dw_1.RowsCopy(dw_1.GetRow(), &
		dw_1.RowCount(), Primary!, dw_2, 1, Primary!)

Example 2

This example copies all the rows starting with the current row in dw_1 to the beginning of the primary buffer in the drop-down DataWindow state_id in dw_3:

datawindowchild dwc

dw_3.GetChild("state_id", dwc)

dw_1.RowsCopy(dw_1.GetRow(), &
		dw_1.RowCount(), Primary!, dwc, 1, Primary!)

Example 3

This example copies all the rows starting with the current row in dw_1 to the beginning of the primary buffer in the nested report d_employee:

datawindowchild dwc

dw_composite.GetChild("d_employee", dwc)

dw_1.RowsCopy(dw_1.GetRow(), &
		dw_1.RowCount(), Primary!, dwc, 1, Primary!)

See also





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

View this book as PDF