IMPORT Action
The IMPORT action imports the contents of the comma delimited text file (CSV) or the XML file or XML string and creates or modifies instances of the specified business object. For example:
IMPORT PersonalSavingAccount FROM 'c:/mydocuments/psa.csv'
IMPORT PersonalSavingAccount FROM XML XmlInput.XMLString
In the first example the object is imported from a file, in the second – from an XML string contained in the XMLString attribute of the XMLInput object.
The format of the CSV and XML file is described in the file ExportImport.txt located in the DOC directory of your Aware IM installation.
The following options can be used with the action:
1. IN BATCHES OF
If the action is likely to import many instances of the business object (hundreds or even thousands) their processing may take a while. In this case it is better to import smaller chunks (batches). After import of each batch finishes the results are immediately committed to the system and stored in the database. If the batch size is not specified the system will only commit the results once all instances have been imported (see Batch Operations). For example:
IMPORT PersonalSavingAccount FROM 'c:/mydocuments/psa.csv'IN BATCHES OF 100
2. WITH VALIDATION
If this keyword is specified any rules associated with the business object being imported will be executed. If any rule fails for some record in the import file, this record will be ignored. If this option is omitted, the instances of the business object will be stored in the system but any rules associated with the business object will not be executed. For example:
IMPORT PersonalSavingAccount FROM 'c:/mydocuments/psa.csv' WITH VALIDATION
NOTE: this option will slow down the import process considerably and is recommended when the import files are not too large. On the other hand using this option will guarantee that only valid instances of the business object are stored in the system.
NOTE: The first line of the input file must contain the description of the imported attributes. If this description contains the ID attribute, the system will look for the specified instances and modify them with the supplied data, otherwise new instances will be created.
See also the Export and Import section.
After the import has been finished a special predefined object called ImportResults is placed into the Context. You can use this object to obtain import log and check whether any errors have been detected. This object has the following attributes –