Language Reference Guide : System Classes : AppSource Class : ImportComp Method
 
Share this page          
ImportComp Method
The ImportComp method loads a frame or procedure stored in an export file into a running application.
This method has the following syntax:
integer = AppSource.ImportComp(filename = varchar(256)
          [, compname = varchar(256)]
          [, format = integer]
          [, metadata = integer])
When you use this method, the imported component is only available to the running application for the duration of the application. The method does not permanently add the component to the application. To import a component permanently into an application so that it is available to the application whenever the application runs, use the ImportApp utility with the -c flag.
This method has the following parameters:
filename
(Required) Specifies the export file that contains the component to be imported. This file must have been created using the ExportApp utility with the -c flag or the ExportComp method of the Proc4GLSource class.
compname
Specifies the name of the component. By default, the ImportComp method uses the component name that is stored in the file. To give the component a different name when you import it into the new application, use the compname parameter.
format
Specifies the format of the file to be imported. Valid format values are:
XF_EXP
Specifies the current export file format
XF_XML
Specifies the XML-based export file format. The II_W4GL_IMPORT_XSD environment variable, which points to the XML schema definition file, see the Workbench User Guide.
XF_ANY
Specifies that the file is either in the current export file format or XML format. ImportComp will first try the current export file format. If this fails because of a format error, the import from XML export format is executed.
XF_DEFAULT
Specifies the import file format specified by environment variable II_W4GL_IMPORT_FORMAT. Valid values are EXP and XML. If II_W4GL_IMPORT_FORMAT is not set (or set to any other value), this is equal to XF_ANY. For more information, see the Workbench User Guide.
Default: XF_DEFAULT
Descriptions of system constant values and their numeric equivalents are listed in Export Format Settings for AppSource and CompSource.
metadata
Specifies that metadata attributes for the component should be used when reassigning attributes. Metadata attributes are AlterDate, AlterBy, CreateDate, and Creator.
The method returns ER_OK if successful. If the component name already exists in the target application, the method returns ER_NAMEEXISTS. Any other error returns a non-zero value. Descriptions of system constant values and their numeric equivalents are listed in Error Codes.
For more information about the ExportApp and ImportApp utilities and importing from XML, see the Workbench User Guide.