Introduction
As discussed in this article, you can use the PrecisionBridge_cmd.exe application to perform command line operations, including writng the Field Mappings to a Database. You will need to provide as a minimum, the location of the project to be run. A full list of parameters that can be used is given at the end of this article.
Parameters
To indicate that the field mapping report is to be written to the reporting target (database), use the -frpt parameter. If this parameter is found, Precision Bridge will write the report instead of executing the project. If it is not found, Precision Bridge will execute the project identified.
The -p parameter is mandatory, this defines the location of the project folder for which field mappings are to be written to the reporting database. All other parameters are optional. Therefore at its most simple, the fiels mappings can be written using the following command:
| PrecisionBridgeCmd.exe -frpt "-p=<path to project>" |
<path to project> must be either an absolute path to the project's root folder, or a relative path to the project folder from the current folder (which will be the folder containing PrecisionBridge.exe)
Note that there must be no whitespace either side of the = character and that if the path contains spaces, the parameter must be enclosed in double quotes.
For example:
| PrecisionBridgeCmd.exe "-p=C:\Users\Admin\Documents\Precision Bridge Projects\Projects\Attachment Testing\A2S Attachments" |
Server Authentication for Command Line Execution
It should be noted that for command line execution, the authentication details for source and target server need to be saved within the project folder.
To write to a reporting server, a reporting database must be configured for the project and the authentication details must, again, be saved within the project folder.
These are saved in the files source.dat, target.dat and rpt.dat. The password component of authentication is encrypted in the file. To ensure the authentication details are saved in this way, open the project using the Precision Bridge Client, enter the authentication details for source, target and reporting server and check the Save Authentication options for each. When the project is opened, the authentication files are created.
Available Parameters
Note that:
- Most parameters have both a long and short name. For example, -p and -project both define the project path.
- All parameter identifiers are case insensitive
- No whitespace should be included between the parameter identifier and the = or between the = and the value.
- If an unrecognised parameter is defined, command line execution will fail with an error.
- Any embedded backslash or double quote characters in parameter values should be escaped with a preceding backslash
Below is a list of all available parameters for Command Line Execution when writing the field mappings to the reporting database.:
|
Parameter |
Notes |
|
-field_report or -frpt |
This MANDATORY parameter indicates that the field mapping report is to be written instead of executing the project. If excluded, Precision Bridge will assume that the project is to be executed. |
|
-project=<path> or -p=<path> |
This MANDATORY parameter specifies the root folder of the project that is to be run. <path> can be either an absolute path, or a path relative to the executable (PrecisionBridgeCmd.exe). |
|
-help or -h or ? |
This parameter writes to output a short description of all valid parameters that can be used. If the -frpt parameter is also included, these will be limited to parameters relating to writing the Field Mappings to the Reporting Database. All other parameters will be ignored if this is found and execution will terminate after help has been output |
|
-out=<path>{:overwrite} or -o=<path>{:overwrite} |
This parameter redirects output from the program to the file given by <path>. The file will be created if it does not exist, however its parent folder must already exist. The optional :overwrite suffix can be used to force overwrite of any existing output file. |
|
-inc_disabled or -id |
Instructs the program to include disabled form mappings when writing field mappings to the reporting database |
|
-inc_unmapped_fields or -iu |
Instructs the program to also write a row for each unmapped target field for all form mappings in the project. |
|
-overwrite or -ow |
Instructs the program to delete any previous field mapping information reported for this project in the reporting database. The project name column is used to find identify previous information for deletion. |
Examples
PrecisionBridgeCmd.exe -frpt "-p=D:\MyProject" -out="D:\MyProject\execOutput.txt:overwrite"
The above command will load MyProject and write all enabled field mappings to the reporting database defined in the project. Output form the process will be written to a file execOutput.txt in the project folder, overwriting any existing file.
PrecisionBridgeCmd.exe -frpt "-p=D:\MyProject" -id
The above command will load MyProject and write all enabled and disabled field mappings to the reporting database defined in the project.
PrecisionBridgeCmd.exe -frpt "-p=D:\MyProject" -iu -ow
The above command will load MyProject and write all enabled field mappings to the reporting database defined in the project and also wrute all unmapped target fields to the reporting database. Following this, any existing rows for project MyProject in the reporting database will be deleted.
Return Values
On completion of the execution, Precision Bridge set the return value as follows:
- Execution completed without error – return 0
- Execution failed due to Fatal Exception – return -1
Comments
0 comments
Please sign in to leave a comment.