Skip Navigation LinksALVAO 10.2ALVAO Asset ManagementImporting/Exporting DataImportUtil Skip Navigation Links. Skip Navigation Links Skip Navigation Links.


ImportUtil

Feature Description

CSV file can contain the following special columns:
Column Description
Class/Kind Specifies the kinds of imported objects in a form of the kind name.
SwProfile Computer object software profile. Values entered into this column have to correspond with the existing software profiles names. If the value is empty, the computer software profile is set to "All software is enabled" value.
NodeId Unique number of each object in the AM (can be displayed on the Objects tab or in the Objects lists window). If the NodeId column is used in the –keyfields parameter and there is no value in the NodeId column, a new object will be created. If no object with specific NodeId exists in the database, a warning will be returned and the object won't be updated and no new object will be created.

This feature uses Object templates from AM for the import process.

Command Line Syntax

ImportUtil -input name of the source CSV file {-conn connection string | -server name of database server -db database name} [-class object type] [-keyfields identification column[,identification column ...]] [-import] [-force]

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 Integrated Windows Authentication. 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 type in the input data (e.g. -class Monitor).
This parameter is required if the source file does not contain either the Type or the Class column. If the source file contains the Type column and the -class object type parameter is specified, the import will only involve those rows whose item in the Type column is identical to that specified in the object type 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.
Note:
If the NodeId column (-keyfields NodeId) is used for identification, you can't use any other columns in the parameter. For more information see the NodeId column description.
-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.
-scrapped If used, this parameter will search and update retired assets during the import.
-datetimeformat Date format in text strings (e.g. dd/MM/yyyy). If no parameter is entered, the format is recognized automatically upon conversion. You can find the detailed description of possible formats in the MSDN.
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 columns 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 set templates used to create Computer type objects.
  • Error while updating an object in the database.

Examples of use

ImportUtil.exe -input import.csv -server .\sqlexpress -db AlvaoSample

This command will validate the import.csv file format in the current folder in relation to the AlvaoSample database located on a local SQL server.

ImportUtil.exe -input import.csv -server .\sqlexpress -db AlvaoSample -import

This command will import the data from the import.csv file to the AlvaoSample 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 AlvaoSample -import -keyfields registration number

This command will update all objects whose registration number item is identical to the value in the update_db.csv file in the AlvaoSample database located on a local SQL server. The AM will update all properties of identified objects and create non-existing objects in the Loaded objects folder.

ImportUtil.exe -input update_db.csv -server .\sqlexpress -db AlvaoSample -import -keyfields NodeId

The command updates the objects property values according to the CSV file if their NodeId matches the values in the CSV file.

Note:
If you want to test the function of the above commands, you can use the sample CSV files import.csv and update_db.csv in the sample ALVAO database (see here).

 

Did not find what you were looking for? Ask our technical support team.