About Command Line Importing
The system’s command line importing feature provides a method for users to run the import process through a command-line execution of the IM module.
This allows imports to be scheduled or run remotely, bypassing all forms and user interface features.
The specified file will be imported and uploaded directly to the destination table; data will be loaded into IM Work Edit (IMWE) only if the import and upload are not successful. This command-line method of invoking the IM module then exits as soon as the import process completes, whether it succeeds or fails.
Formatting a Command Line
This section discusses how to format a command line. The basic format of a command-line driven executable is as follows:[Command Name] [Parameter]
At the command prompt, type a program name, followed by a space, and then the parameters. For example:
In this example, the program is ping (file name is ping.exe) and the parameter is devel (the name of the computer to test against).
Sometimes, programs require more than one parameter to be specified, so a switch must be used to help the program differentiate between parameters. For example:
C:\>ping -w 500 -n 4 devel
In this example, the ping utility is told to wait (the -w switch) up to 500 milliseconds for each reply. The number of transmission attempts (the -n switch) is set to 4. The IM module may be similarly invoked using a command line, as discussed in the “Triggering an Automated Import” section below.
Triggering an Automated Import
The auto-import feature is integrated into the IM module, so the program name specified in the command line is “IMAuto” (the file name is “IMAuto.exe”). The parameters are as follows (do not type the brackets):
(Required) Username for the Vista application.
(Required) Password for the Vista application.
-h <database host>
(Required) Vista database server.
(Required) Vista database name.
-a <application server>
(Optional) Application where remote service and Viewpoint Repository reside; if same as database server, this parameter is unnecessary.
-s <application port>
(Required) Application port number, on the application server, used by remote service; default port number is 5151551516.
-f <file path>
(Required) File to import (full UNC path).
(Required) Viewpoint Import Template to use.
-c <co #>
(Optional) Default company number (if needed).
-l <logfile path>
(Optional) Log results to specific folder.
-e <use windows login>
(Required if logging in with Windows login.) Log in using Windows login.
For example, a command line import might be executed by issuing the following command:
C:>IMAuto.exe -u johnd -p mypwd -h Viewpoint -d Viewpoint -a VCS601Dev -s 5151551516 -f \\johnd\imtestfiles\AMI Scale.txt -t AMIScale
When this command line is executed, the auto-import process would start, connect to the Vista database through the system’s ODBC connection using “johnd” as the user with “mypwd” as the password, and import the file to “\\johnd\imtest files\AMI Scale.txt” using the template named “AMIScale”.
The key to making the automated import process useful and flexible is that command lines can be executed by a variety of programs, including the Windows Scheduler. Additionally, users can develop their own tools to monitor folders and import files when needed.
Monitoring Log Files
A log file is created for each command-line execution of IM and contains messages displaying import progress, major events (including errors), and other vital information. The path name indicated in the command line must already exist; this process does not create folders. If the path is not found, or is not specified, log files are placed in the same folder as the file being imported.
The naming convention for log files is a combination of “IMAuto” and the date and time, using a format of YYMMDDhhmmssff (for example, “IMAuto18071408263693.log”). This same name (minus the “.log” extension) is used within Vista as the ImportID and can be used to view the work file (in IM Work Edit) should the import fail. For more information, refer to IM Work Edit in Related Topics below.
Expand the links below to view log file examples.
Log file from a successful import
07/14/2018 08:15:34 Start auto-import process.
07/14/2018 08:15:34 Importing file: \\johnd\imtestfiles\AMI Scale.txt
07/14/2018 08:15:34 Connecting to datasource: VisTestData, Database: VisTestData, User: johnd
07/14/2018 08:15:34 Checking template: AMI TestRT
07/14/2018 08:15:34 Importing file.
07/14/2018 08:15:34 Using default company: 1
07/14/2018 08:15:34 Using import id: IMAuto18071408153426
07/14/2018 08:15:37 Uploading file.
07/14/2018 08:15:38 Upload successful.
07/14/2018 08:15:38 NOTE: 1 or more batches created - view in IM Batch Id using import id: IMAuto18071408153426
07/14/2018 08:15:38 End auto-import process.
Log file where the log path was not found
04/11/2018 08:28:48 Log path not found: c:\imtestfiles\logfiles\ -- Continuing with: \\johnd\imtestfiles\
04/11/2018 08:28:48 Start auto-import process.
04/11/2018 08:28:48 Importing file: \\johnd\imtestfiles\AMI Scale.txt
04/11/2018 08:28:48 Connecting to datasource: VisTestData, Database: VisTestData, User: johnd
04/11/2018 08:28:48 Checking template: AMI TestRT
04/11/2018 08:28:48 Importing file.
04/11/2018 08:28:48 Using default company: 1
04/11/2018 08:28:48 Using import id: IMAuto18041108284889
04/11/2018 08:28:51 Uploading file.
04/11/2018 08:28:54 Upload successful.
04/11/2018 08:28:54 NOTE: 1 or more batches created - view in IM Batch Id using import id: IMAuto18041108284889
04/11/2018 08:28:54 End auto-import process.
Log file where the command line was missing a parameter
07/14/2018 08:17:46 Error parsing command line parameters: Login missing
07/14/2018 08:17:46 Command Line: 07/14/2018 08:15:34 Start auto-import process.
07/14/2018 08:17:46 Command Syntax: im.exe -u <user name> -p <password> -o <ODBC connection> -d <database> -f <full import file path> -t <import template> [-c <default company> -l <log path>]
Log file with errors during import
07/14/2018 08:30:55 Start auto-import process.
07/14/2018 08:30:55 Importing file: \\johnd\imtestfiles\PR\PRTB_061704.CSV
07/14/2018 08:30:55 Connecting to datasource: VisTestData, Database: VisTestData, User: johnd
07/14/2018 08:30:55 Checking template: PR
07/14/2018 08:30:55 Importing file.
07/14/2018 08:30:55 Using default company: 1
07/14/2018 08:30:55 Using import id: IMAuto18071408305569
07/14/2018 08:30:57 Uploading file.
07/14/2018 08:30:57 Error: Import Contains Invalid Payroll Ending Dates. - Unprocessed records may still exist in IM Work Edit.
07/14/2018 08:30:57 End auto-import process.