DataSource PowerScript function
Description
Allows a RichTextEdit control to share data with a DataWindow
and display the data in its input fields. If there are input fields
in the RichTextEdit control that match the names of columns in the
DataWindow, the data in the DataWindow is assigned to those input
fields. The document in the RichTextEdit control is repeated so
that there is an instance of the document for each row in the DataWindow.
Controls
RichTextEdit controls
Syntax
1 |
<span>rtename</span>.<span>DataSource</span> ( <span>dwsource</span> ) |
Argument |
Description |
---|---|
rtename |
The name of the RichTextEdit control |
dwsource |
The name of the DataWindow control, DataStore, |
Return Values
Integer. Returns 1 if it succeeds and
-1 if an error occurs.
Usage
When names of input fields match names of columns in the DataWindow object,
the data in the columns is assigned to the matching input fields.
The document in the RichTextEdit control is associated with
one row in the DataWindow. There is an instance of the document
for each retrieved row. The text in the RichTextEdit control is
repeated, with all its formatting, in every document instance. The
content of the input fields changes as the data in each row changes.
Except for the contents of the input fields, the contents of each instance
is the same—you cannot make changes to the surrounding
text that affect individual instances only.
If the InputFieldNamesVisible property of the RichTextEdit
control is true, the fields will show their names
instead of the data they contain. Change the property value to false to
see the data. The following RichTextEdit functions operate on or
report information about an instance of the document:
|
|
The following RichTextEdit function affects the collection
of documents:
-
Print
Examples
This example establishes the DataWindow control dw_1 as
the data source for the RichTextEdit rte_1:
1 |
rte_1.<span>DataSource</span>(dw_1) |
This example inserts a document called LETTER.RTF into
the RichTextEdit rte_letter (the names
of the document’s input fields match the columns in a DataWindow
object d_emp), creates a DataStore,
associates it with d_emp, and retrieves
data. Then it inserts the document in rte_letter and
sets up the DataStore as the data source for rte_1:
1 |
DataStore ds_empinfo |
1 |
ds_empinfo = CREATE DataStore |
1 |
ds_empinfo.DataObject = "d_emp" |
1 |
ds_empinfo.SetTransObject(SQLCA) |
1 |
ds_empinfo.Retrieve() |
1 |
1 |
rte_letter.InsertDocument("LETTER.RTF", TRUE) |
1 |
rte_letter.<span>DataSource</span>(ds_empinfo) |
See Also
-
InputFieldChangeData, InputFieldCurrentName, InputFieldDeleteCurrent, InputFieldGetData, InputFieldInsert