LibraryImport
PowerScript function
Description
Imports a DataWindow object into a library. LibraryImport uses the
syntax of the DataWindow object, which is specified in text format, to
recreate the object in the library.
Syntax
|
1 |
LibraryImport ( libraryname, objectname, objecttype, syntax, errors {, comments } ) |
|
Argument |
Description |
|---|---|
|
libraryname |
A string specifying the name of the PowerBuilder library |
|
objectname |
A string specifying the name of the DataWindow object you |
|
objecttype |
A value of the LibImportType enumerated datatype |
|
syntax |
A string specifying the syntax of the DataWindow object |
|
errors |
A string variable that you want to fill with any error |
|
comments (optional) |
A string specifying the comments you want to associate |
Return value
Integer.
Returns 1 if it succeeds and -1 if an error occurs. If any
argument’s value is null, LibraryImport returns null.
Usage
When you import a DataWindow, any errors that occur are stored in
the string variable you specify for the error argument.
When your application creates a DataWindow dynamically at runtime,
you can use LibraryImport to save that DataWindow object in a
library.
Examples
These statements import the DataWindow object d_emp into the library
called dwTemp and store any errors in ErrorBuffer. Note that the syntax is
obtained by using the Describe function:
|
1 2 3 4 5 6 7 |
string dwsyntax, ErrorBuffer integer rtncode dwsyntax = dw_1.Describe("DataWindow.Syntax") rtncode = LibraryImport("c:pbdwTemp.pbl", & "d_emp", ImportDataWindow!, & dwsyntax, ErrorBuffer ) |
These statements import the DataWindow object d_emp into the library
called dwTemp, store any errors in ErrorBuffer, and associate the comment
Employee DataWindow 1 with the entry:
|
1 2 3 4 5 6 7 8 |
string dwsyntax, ErrorBuffer integer rtncode dwsyntax = dw_1.Describe("DataWindow.Syntax") rtncode = LibraryImport("c:pbdwTemp.pbl", & "d_emp", ImportDataWindow!, & dwsyntax, ErrorBuffer, & "Employee DataWindow 1") |
See also
Describe method for DataWindows in the section called “Describe” in DataWindow Reference.