.Exporting and Importing the Import Formats v2023.1
Overview
It is possible to export an Import Format into a JSON file, and then import that JSON file to create or update that Import Format. This functionality makes copying an Import Format from Test to Prod quick and error-free.
The Export or Import can be done from the Import Formats grid, using the and buttons.
These Export/Import operations can also be done from the command line on the PCR360 server. This is useful if you have several Import Formats you want to Export or Import. You can create a script to do them all at once. The JSON files will be stored or read on the server instead of your local PC when using the Command Line. If you need assistance creating a script, please get in touch with Professional Services.
When an Import Format is imported into PCR-360, a Remark will be added to the Import Format's Remarks tab to indicate the format was imported into PCR-360.
Exporting/Importing an Import Format
To Export an Import Format from PCR-360
- Go to the Import Formats grid.
- Select a single grid line and press button.
- That Import Format will be converted to a JSON file and downloaded to your PC. The filename will match the Import Format name but with any special characters converted to underscores. The original Import Format name will be preserved in the JSON file.
- The JSON export will include all Record Formats, mapped columns, and Conditional Logic. It will not include any Remarks or Attachments in the Import Format.
To Import an Import Format from PCR-360
- To import a JSON file into the Import Formats grid:
- Go to the Import Formats grid.
- Press the button.
A file selection dialog will open. You can select any number of JSON files that were previously downloaded. Then all of those files will try to upload and become Import Formats. The original name of each Import Format is inside the JSON file so that it will be imported with the original name.
If the uploaded Import Format already exists, then the existing Format will be updated to match what was in the JSON file. If the current Import Format has any Remarks or Attachments, the import will not affect them.
To Export an Import Format from the Command Line
You need to identify which Import Format you want to export. The import format's name might contain spaces, quotes, slashes, or any number of characters that will cause difficulties if you try to use them in a shell command. So instead, you will need to use the Recid of the format you want to Export. You can get this from the Import Formats grid by turning on the Row ID column.
The command can be run from anywhere. The JSON file will be created in your current directory.
Here is the command to Export an Import Format, assuming Prod environment and Import Format recid 146:
- sudo php /var/www/pcr360/prod/cli/zfcli.php -a core.import-file.export -e prod -d -i '/var/www/pcr360/configs/pcr360.ini' -p 'recid=146'
For Test environment, this:
- sudo php /var/www/pcr360/test/cli/zfcli.php -a core.import-file.export -e test -d -i '/var/www/pcr360/configs/pcr360.ini' -p 'recid=146'
This command will create a JSON file in your current directory. The file's name will be similar to the Import Format name, but all of the spaces and other non-alphanumeric characters will be replaced with underscores.
To Import an Import Format from the Command Line
- The command should be run from where the JSON file is located. The JSON filename will be in the command. It will be assumed that the file will be in the current directory.
- The command for the Prod environment is:
- sudo php /var/www/pcr360/prod/cli/zfcli.php -a core.import-file.import -e prod -d -i '/var/www/pcr360/configs/pcr360.ini' -p 'filename=Your_Import_Format.json'
- For Test environment, this:
- sudo php /var/www/pcr360/test/cli/zfcli.php -a core.import-file.import -e test -d -i '/var/www/pcr360/configs/pcr360.ini' -p 'filename=Your_Import_Format.json'
- For Test environment, this:
Notes about running the processes from the Command Line
Depending on your installation, you may need a different name for your config file.
The "sudo" at the front of the command will let the command run as root. This is not needed for the command to work. However, if you don't run it as root, then you may get a few pages of warnings regarding failures to write to some php cache files that are owned by root or apache. If this happens, the warnings can be ignored. The Imports and Exports should still work.
Help Desk Portal - Email: help@pcr.com - Phone: 616.259.9242