Skip Headers
Agile Recipe Management for Pharmaceuticals Import/Export Guide
Release 9.3.4
E39291-02
  Go To Table Of Contents
Contents

Previous
Previous
 
Next
Next
 

4 Exporting and Importing Data from the Command Line

This chapter provides information on commands and parameters required to run the export or import operation.

4.1 Export/Import Parameters

These parameters are listed and described in the following tables.

4.1.1 Export Parameters

Option Description
-c Path of the file containing the export criteria in XML format.

If the file path contains only file name, the file is read from the current working directory. Otherwise, the file will be loaded from the specified location.

-u Login details for user to connect to RMW in <userid>/<Password> format.

Password should not contain a "slash" (/).

-d RMW database name from which the data is being exported.

This is the logical name of the database being accessed. The database name is found in CFMDBConfig.xml file or the login page of RMW. The database name is usually 'Production' or 'Development'.

-o Output filename, which will be created by the export program containing exported data.

User can also give a file pattern while exporting. The filename will be generated using the primary category data.

For example: -o F:\data\migration\{Name}.xml if used while exporting subview or view, the {Name} part in the output file name will be replaced with the view/subview name.

User can give one or more attributes from primary category table. If an attribute name has blank character, the blank/space character should be replaced with '#'.

For example: F:\data\migration\{DB#Name}.xml

-pc Used to override the primary category table with a different child category table when exporting.

User can specify the table name with which the primary category should be replaced. It can accept comma separated table names to export from multiple categories.

Distinct XML files will be generated for each of the categories and the file name would have the category table name prefixed with the output file name specified in the -o option

-h Used to export record from the entire hierarchy tree.

User has to give the parent node table name from where he/she wants to export the sub tree hierarchy data including the parent node.

Distinct XML files will be generated for each of the categories in the hierarchy and the file name would have the category table name prefixed with the output file name specified in the -o option.


4.1.2 Import Parameters

Option Description
-u Login details for user to access R&MW in <userid>/<Password> format.

Password should not contain a "slash" (/).

-d RMW database name from which the data is being imported.

This is the logical name of the database in the R&MW Application being accessed. The database name is found in CFMDBConfig.xml file or RMW login page. The database name is usually 'Production' or 'Development'.

-i Used to specify the input data file name including full path, this information will be used by the import program to import data into the target database.
-op Used to specify the types of transactions that can be performed on the objects present in the database. The transactions are one of the following: UPD, INS, DEL, or RPL. See definitions below.
UPD Read the import data file specified in the -i parameter.

For every object in the file:

Search the database for object matching the same criteria (same primary keys)

If object found, update the database object with values from the object in the import file.

If no object matching the criteria found, log an error

INS Read the import data file specified in the -i parameter.

For every object in the file, insert a new database object with values from the object in the import file.

DEL Read the import data file specified in the -i parameter.

For every object in the file:

Search the database for object matching the same criteria (same primary keys)

If object found, delete the database object

If no object matching the criteria found, log an error

RPL Replace mode: If the data being imported does not exist in the target database, then it is inserted. If the data being imported exists in the target database, then it is updated.

4.2 How to Export

To begin exporting information from RMW:

  1. Configure the application server information in the export command file.

    For more information, see Updating the Export or Import Command Files.

  2. Update the criteria properties template file to export specific information.

    For more information, see Updating Template Files.

  3. From the respective console, start the export operation:

    • For Windows, from the command prompt, execute the following commands:

      cd AgilePharma\exim\bin

      export.bat

      where AgilePharma\exim is the location where the export/import tool is installed.

    • For UNIX, from the shell prompt, execute the following commands:

      .cd AgilePharma/exim/bin

      ./export.sh

      where AgilePharma\exim is the location where the export/import tool is installed.

      To complete the export process:

  1. The AppServer URL information is displayed.

    • For Windows, from the command prompt, execute the export command:

      export -u <user name/password> -d <database name> -c <criteria file name> -o <output file name>

      If the record fails to export, the event is recorded in the log file that is created by the export program.

      The output.xml and .log files will be created. The log files contain a record of the export operation

    • For UNIX, from the command prompt, execute the export command:

      ./export.sh -u <user name/password> -d <database name> -c <criteria file name> -o <output file name>

      If the record fails to export, the event is recorded in the log file that is created by the export program.

      The output.xml and .log files will be created. The log files contain a record of the activities during export operation.

      The XML file contains object tags. An object represents a record (a row in a table).

4.2.1 Log File

The Export tool creates a log file containing all the informational and error messages, and number of records exported from each category. The log file name is the same as the output file name with .log suffix.

For example: If the output file name is my_data_xport.xml, the log file name will be my_data_export.xml.log

The export log should contain the following information:

  • The login username of the user who performed the export operation

  • Execution date and time of the export

  • Schema, Criteria, and Properties file name used for the export operation

  • A summary for each business object exported, as shown here:

Primary Category: D_ORG_SITE

Primary Category Internal id: LDD424

Processed Record count by category: {D_ORG_SITE_MATERIAL_TYPE=0, D_PPL_ADDRESS=1, D_ORG_SITE_STORAGE=1, D_ORG_SITE_EQUIPMENT_LK=0}

Total processed count: 3

4.3 How to Import

To import information into RMW:

  1. Configure the Application Server information in the import Command File.

    For more information, see Updating the Export or Import Command Files.

  2. Optional: Update the schema template file for cache refresh.

    For more information, see Updating the Schema template file for Refreshing Cache

  3. From the respective console, start the import tool:

    • For Windows, from the command prompt, execute the following commands: cd AgilePharma\exim\bin import.bat where AgilePharma\exim is the location where the export/import tool is installed.

    • For UNIX, from the shell prompt, execute the following commands: .cd AgilePharma/exim/bin ./import.sh where AgilePharma/exim is the location where the export/import tool is installed.

  4. From the command prompt, execute the import command.

  • For Windows:

    import -u <user name/password> -d <database name> -i <input file path> -op <INS|UPD|DEL|RPL>

  • For UNIX:

    import -u <user name/password> -d <database name> -i <input file path> -op <INS|UPD|DEL|RPL>

4.3.1 Modes of Import

  • Insert mode: If the data being imported does not exist in the target database, it is inserted. If the data being imported already exists, an error message is displayed and no changes are made to the target database.

  • Update mode: If the data being imported does not exist in the target database, it is inserted. If the data being imported already exists, the existing information is updated.

  • Delete mode: If the data being imported exists in the target database, it is deleted. If the data being imported does not exist in the target database, an error message is displayed and no changes are made to the target database.

  • Replace mode: If the data being imported does not exist in the target database, then it is inserted. If the data being imported exists in the target database, then it is updated.

If the record fails to import, the event is recorded in the log file that is created by the export program.

4.3.2 Import Failure

If an import operation fails, the <import file name>.failed files are generated with the name of the input files. These failed files can be used for repeating the import operation.

Every failed import creates a log file using the session ID on the server. In case of a failure, you can look into this file to understand the details of activities on the server side. This log file is also created for a successful import operation.

4.3.3 Rollback

During the import operation, if some records related to the imported business object failed to import, the complete business object is rolled back and is not committed. This is recorded in the log file.

4.3.4 Log Files

Log File Description
<import xml file name>.failed Logs BO records that were not imported.
<import xml file>.<Operation><number>.log Logs the number of insert, update, and delete operations performed.
<import xml file>.<Operation>.log Logs client-side processing details.
CFMMigration_<sessionid>.log Logs server-side processing details.

4.4 Batch Exporting and Importing

"BatchML", an XML using tags specified in S-88, is now available for the Work Request, Recipe, and Control Recipe. A typical Recipe may contain Equipment, Materials, or Inventory. When a Recipe is approved in RMW, the approved recipe is exported via BatchML. The same BatchML is imported to Agile PLM 9.3.x and stored against the Item as an Attachment.

Import and Export BatchML is available through the User Interface. Import/Export Batch ML for Work Requests only are available through Web Services in Rel. 9.3.1.1.

4.4.1 Batch Export

Batch Export of a business object exports the business objects and saves different instances in different XML files.

For example, for batch export of a Campaign object, type the command:

BatchExport -d Development -u <username>/<encrypted_pwd> -c <AgileRMW_Home>\exim\templates\criteria\campaign_criteria.xml -o <Output_File_Location>\output\Cam\Cam_{Campaign#Name}.xml

This will create XML file with Campaign Name. The string inside { } will be any attribute -

Cam_{Campaign#Name}.xml

- here the "#" character is not part of the Attribute, it is being used to replace the "space" character in the Attribute name. Campaign Name is the primary key for this object, so for multiple instances of Campaign batch export creates multiple XML files and saves them as cam_{Campaign#Name}.xml

The attribute name should be exactly same as that mentioned in the properties file.

We can export files using patterns. This can export a single business object and save the different instances as different XML files.

4.4.2 Batch File Export

BatchFileExport.bat file is used to do a batch file export of a sequence of objects using properties file.

User can specify multiple criteria and patterns to export using multiple objects at once.

With reference of BatchFileExportREADME.txt file, create batchfileexport.properties in exim\bin folder.

In thebatchfileexport.properties file, specify the criteria:

criteria.keys=1,2...

user=admin/{encrypted password}

db=<db name>

criteria.1.file=<criteria file path>

criteria.1.out=<output file name>

criteria.1.param=<criteria for which you want to export>

criteria.1.seqFileFolder=<sequence file path>

For example:

criteria.1.file=F:/mystarteam/mainline/conformia/pcm/dev/config/migration/criteria/AutoSequence_Criteria.xml

criteria.1.out=F:/dataloader/post/seed/AutoSeq/autoseq_{Name}.xml

criteria.1.param=$$_MET_AUTO_SEQ_NAME=AUDIT_INTERNAL_ID|WF_TASK_ID

criteria.1.seqFileFolder=F:/dataloader/post/seed/AutoSeq/

Likewise, you can mention different criteria in different criteria keys and export more than one object at a time.

This example will export instances based on parameter given for AutoSequence_Criteria object and save them asautoseq_{attribute} file in the specified folder.

The string inside { } will be any attribute -

Cam_{Campaign#Name}.xml

- here the '#' is not part of the Attribute, '#' are used to replace ' '(space) in Attribute name.

Campaign Name is the primary key for campaign object, so for multiple instances of Campaign, batch export creates multiple XML files and saves them as cam_{Campaign#Name}.xml

The attribute name should be exactly same as that mentioned in the properties file.

Execute the command to do BatchFileExport:

BatchFileExport.bat BatchFileExport.properties

4.4.3 Batch Import

We can import data for multiple instances of multiple objects using diferent modes of operation at a time.

With reference of BatchImportREADME.txt file, create batchimport.properties in exim\bin folder.

In thebatchimport.properties file, specify the criteria:

import.keys=0,1

user=admin/{encrypted password}

db=<db name>

import.0.dir=<path of xml files to be imported import.0.operation=<ins/upd/del/rpl>

For example:

import.0.dir=C:/Agile/Agile9311Build34/AgilePharma/exim/output/menu

import.0.operation=INS

In this example, in the folder menu all the XMLs will be imported in INS mode for menu object.

Execute the command: BatchImport.bat BatchImport.properties