ImportClipboard
method (DataWindows)
Description
Inserts data into a DataWindow control or DataStore object from
tab-separated, comma-separated, or XML data on the clipboard.
Applies to
|
DataWindow type |
Method applies to |
|---|---|
|
PowerBuilder |
DataWindow control, DataWindowChild object, DataStore |
Syntax
PowerBuilder
|
1 |
long dwcontrol.ImportClipboard ( {saveastype importtype}, { long startrow {, long endrow {, long startcolumn {, long endcolumn {, long dwstartcolumn } } } } } ) |
|
Argument |
Description |
|||
|---|---|---|---|---|
|
dwcontrol |
A reference to a DataWindow control, DataStore, or |
|||
|
importtype (optional for PowerBuilder) |
An enumerated value of the SaveAsType DataWindow
If you want to generate an XML trace file, |
|||
|
startrow (optional for PowerBuilder) |
The number of the first detail row in the clipboard For default For template XML import, if startrow is |
|||
|
endrow (optional for PowerBuilder) |
The number of the last detail row in the clipboard For default XML import, if endrow is supplied, For template XML import, |
|||
|
startcolumn (optional for |
The number of the first column in the clipboard that For default XML This argument |
|||
|
endcolumn (optional for PowerBuilder) |
The number of the last column in the clipboard that For default XML import, if endcolumn is This argument has no effect on template XML |
|||
|
dwstartcolumn (optional for |
The number of the first column in the DataWindow |
Return value
Returns the number of rows that were imported if it succeeds and one
of the following negative integers if an error occurs:
-1 — No row is supplied or the startrow value supplied is greater
than the number of rows in the string
-3 — Invalid argument
-4 — Invalid input
-11 — XML Parsing Error; XML parser libraries not found or XML not
well formed
-12 — XML Template does not exist or does not match the
DataWindow
-13 — Unsupported DataWindow style for import
-14 — Error resolving DataWindow nesting
Usage
The clipboard data must be formatted in tab-separated or
comma-separated columns or in XML. The datatypes and order of the
DataWindow object’s columns must match the data on the clipboard.
If an XML or CSV column contains a leading double quote, it is
assumed to be part of the column value. A leading double quote has to be
closed to mark the end of an item.
All the arguments of this function are optional. You do not need to
specify the importtype argument. The startcolumn and endcolumn arguments
control the number of imported columns and the number of columns in the
DataWindow that are affected. The dwstartcolumn argument specifies the
first DataWindow column to be affected. The following formula calculates
the last column to be affected.
|
1 |
dwstartcolumn + (endcolumn - startcolumn) |
ImportClipboard does not support Crosstab DataWindow objects.
Examples
This statement copies all data in the clipboard to the DataWindow
dw_employee starting at the first column:
|
1 |
dw_employee.ImportClipboard() |
This statement copies all data in the clipboard to the DataWindow
dw_employee starting at the first column and specifies that the data is in
XML format:
|
1 |
dw_employee.ImportClipboard(XML!) |
This statement imports rows 1 to 200 of the XML data on the
clipboard, ignoring any template mappings before column 5:
|
1 |
dw_employee.ImportClipboard(XML!, 1, 200, 0, 0, 5) |
This statement inserts data from the clipboard into the DataWindow
dw_employee. It copies rows 2 through 30 and columns 3 through 8 on the
clipboard to the DataWindow beginning in column 5. It adds 29 rows to the
DataWindow with data in columns 5 through 10:
|
1 |
dw_employee.ImportClipboard(2,30,3,8,5) |
See also