ImportUtil
Feature Description
This feature enables you to import new objects to the "Loaded objects" folder and to update existing objects in ALVAO Asset Management (AM) from CSV files, where ';' is used for the column separator and the line break as the row separator. The first line contains the names of properties.
This feature uses Object templates from AM for the import process.
Feature Syntax
ImportUtil -input "name of the source CSV file" {-conn "connection strin | -server "name of database server" -db "database name"} [-import] [-force] [-class "object kind"] [-keyfields "identification column[,identification column ...]"]
Detailed Description of Parameters
Parameter
|
Description
|
-input
|
Specifies the name and path of the source CSV file (e.g. "D:\import\import.csv")
|
-conn -server -db
|
These parameters contain connection settings for the ALVAO database. You can use connection strings (e.g. -conn "Data source=.\sqlexpress;Initial Catalog=test;Integrated Security = True"), or enter a specific SQL server and database (e.g. -server ".\sqlexpress" -db "test"). If you use the -server and -db parameters, the system will connect to the database using the integrated Windows logon. If you specify all parameters, only the -conn parameter will be used. The parameters -server and -db will be ignored.
|
-import
|
If used, the data are imported to the database; otherwise the system will perform only an import validity check
|
-class
|
This parameter allows you to specify the object kind in the input data (e.g. -class "Monitor"). This parameter is required, if the source file does not contain either the "Kind", or the "Class" column. If the source file contains the column "Kind" and the parameter -class "object kind" is specified, the import will only involve those rows whose item in the "Kind" column is identical to that specified in the "object kind" parameter.
|
-keyfields
|
This parameter identifies and updates existing objects. The specified columns represent a unique identifier (e.g. -keyfields "Serial number, Model"). If the identifier does not correspond to any item in the database, a new object will be created in the Loaded objects folder
|
-force
|
If used, the data will be imported to the database, ignoring all item errors. If not used, any error will cause the import process to fail and no records will be imported.
|
Note:
Below is a list of errors that can be ignored when using the -force parameter and that do not cause the entire import process to fail. Errors included in the import results as skipped items: Multiple objects with key values in the column(s) selected with the -keyfields parameter. For more information on the -keyfields parameter see above. Missing template for an object embedded in a file. For more information, please refer to the -class parameter above. Duplicate records in the source file. Errors included in the import results as failed records: Error while creating an object based on an object template, including computer assembly templates used to create an object of the "Computer" type. Error while updating an object in the database.
Examples of use
ImportUtil.exe -input "import.csv"-server ".\sqlexpress" -db "test"
This command will validate the "import.csv" file format in the current folder and in relation to the "test" database located on a "local SQL server".
ImportUtil.exe -input "import.csv"-server ".\sqlexpress" -db "test" -import
This command will import the data from the "import.csv" file to the "test" database located on a "local SQL server". The AM will create corresponding new objects in the Loaded objects folder.
ImportUtil.exe -input "update_db.csv"-server ".\sqlexpress" -db "test" -import -keyfields "Serial Number"
This command will update all objects whose "Serial Number" item is identical to the value in the "update_db.csv" file in the "test" database located on a "local SQL server". The AM will update all properties of unidentified objects and create non-existing objects in the Loaded objects folder.
Did not find what you were looking for? Ask our technical support team.
|