LibraryImport

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

LibraryImport ( libraryname, objectname, objecttype, syntax, errors   {, comments } )

Argument

Description

libraryname

A string specifying the name of the PowerBuilder library into which you want to import the entry. If you do not specify a full path, LibraryImport uses the system's standard file search order to find the file.

objectname

A string specifying the name of the DataWindow object you want to import.

objecttype

A value of the LibImportType enumerated datatype identifying the type of object you want to import. The only supported object type is ImportDataWindow!.

syntax

A string specifying the syntax of the DataWindow object you want to import.

errors

A string variable that you want to fill with any error messages that occur.

comments (optional)

A string specifying the comments you want to associate with the entry.


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:

string dwsyntax, ErrorBuffer
integer rtncode
 
dwsyntax = dw_1.Describe("DataWindow.Syntax")
rtncode = LibraryImport("c:\pb\dwTemp.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:

string dwsyntax, ErrorBuffer
integer rtncode
 
dwsyntax = dw_1.Describe("DataWindow.Syntax")
rtncode = LibraryImport("c:\pb\dwTemp.pbl", &
    "d_emp", ImportDataWindow!, &
      dwsyntax, ErrorBuffer, &
        "Employee DataWindow 1")

See also

Describe method for DataWindows in the section called “Describe” in DataWindow Reference.

LibraryCreate

LibraryDelete

LibraryDirectory

LibraryImport