• No results found

Importing an MRP File Without a ComponentName

This lesson also illustrates the process of importing data from a non-P-CAD source. The imported data will again be used to update the P-CAD library, Ale_tutor.lib, using ComponentName as the primary key.

The difference between the two lessons is the data contained within the MRP file. Lesson 2 imports a comma-delimited source file that does not contain the primary key, ComponentName. Instead, the data in this file is referenced by a unique Part Number.

In this lesson, you will be importing the sample comma-delimited file, Ale_crosslink.txt. This

Chapter 13: Extended Library Features Import and Export from External Sources

introduce the Cross Linking function of Library Executive. For additional information about the Cross Link feature, see the Importing Data from an External Source (page 121).

Because the imported file does not contain a ComponentName, a few additional steps are necessary in comparison to Lesson 1. The first step serves the purpose of inserting the MRP database index identifier, Part Number, as an attribute of its associated component. Since this attribute is saved with the library, this step need only be completed once.

The remaining steps are the import and update process for an external file without a

ComponentName. These steps are completed every time you wish to update the P-CAD library components from this external source file.

This lesson assumes that you have already set up the Ale_tutor.lib so it is available for Library Executive. If not, open the Source Browser and select the DEFAULT_LIBRARY_SET. Choose Add Library to add the sample library to the default set.

You can follow along the next few sections, using the sample files to complete each of these steps yourself.

Step 1: Adding the Part Number Attribute to a Library

When importing an MRP file that does not contain the ComponentName field, some connection must be defined that associates a P-CAD library component with its MRP entry. This association can be completed in a variety of ways. The most automated technique is through the use of a map file.

In this section, you will be completing the miniature import/update process of adding the Part Number attribute to a P-CAD component library. This attribute is the unique index identifier of the MRP database. Once added, Library Executive will automatically know which component you are referring to when you import a component identified solely by a Part Number.

The map file is a simple, comma-delimited external source file. This file provides the cross

reference between the ComponentName and Part Number fields. With the information in the map file, you will merge the external file’s data with the associated component data in the P-CAD library.

To add the Part Number to the library:

1. Choose File » Import to open the Import Separated List File dialog.

2. Click the Browse button. Navigate to the Tutorial folder in the P-CAD installation directory and select the comma-delimited source file Ale_map.txt.

Import and Export from External Sources Chapter 13: Extended Library Features

3. Click the First line contains field names button since the first line of the sample file contains the field names that correspond to the file contents.

If the first line of the external source file did not contain field names, the Generate default field names button should be selected.

4. Enter or select a character in the List Separator box.

5. Enter or select a character in the Comment Character box.

6. Click OK. The external source file Viewer appears.

The field names are the column headers with the field values filling in the table contents.

Step 2: Updating the Library

The Viewer appears with the two column contents of the map file, ComponentName and Part Number. At present the components in the P-CAD sample library, Ale_tutor.lib, are only referenced by the ComponentName and the MRP database is only referenced by the Part Number.

The following steps will link the Part Number to an associated ComponentName within the library.

1. Save the Part Number attribute to the library by choosing the Save to Library command from the Table menu. From the Table command of the file Viewer, choose Save to Library. The Save Source dialog appears.

Chapter 13: Extended Library Features Import and Export from External Sources

2. Select the Update option button.

3. Click the Library button, navigate to the Tutorial folder in the P-CAD installation directory and select the Ale_tutor.lib library. Click Open. The selected library name displays in the edit box.

There are no new components in the imported MRP file. Leave the Create new components box cleared.

Since the MRP file does not contain a ComponentLibrary attribute, leave the Update only components with matching library name box cleared.

4. Select the Create component time stamps if not present check box when adding or updating the ModifyDate attribute in the component library.

5. All attributes that will be updated in the library are listed in the Attribute Conflict Resolution section. For Part Number, select Source and then click OK to apply the update.

The Part Number and the ComponentName are now linked. This allows you to reference data by the ComponentName or the Part Number fields.

6. Click OK. The library has been updated to reflect the new PartNumber attribute value.

Step 3: Importing an MRP without a ComponentName

Once the Part Number has been added to the sample library, you never have to repeat the above step again. The library components are now associated with the Part Number index of the company database. From here on out, to import the MRP sample file without a ComponentName, you can start with the step you just completed.

The Ale_crosslink.txt file is a comma-delimited external source file. This sample file has been generated from a component database and includes the following attributes: Part Number, Vendor, Quantity, and Cost. Note that there is no ComponentName field. The Part Number, which was added to the library in the step above, will be used from this point forward to reference the library components.

Import and Export from External Sources Chapter 13: Extended Library Features

Import the map file by following these steps:

1. Choose File » Import to open the Import Separated List File dialog.

2. Click the Browse button. Navigate to the Tutorial folder in the P-CAD installation directory and select the comma-delimited source file Ale_crosslink.txt.

3. Click the First line contains field names button since the first line of the sample file contains the field names that correspond to the file contents.

If the first line of the external source file did not contain field names, the Generate default field names button should be selected.

4. Enter or select a character in the List Separator box.

5. Enter or select a character in the Comment Character box.

6. Click OK. The external source file Viewer appears.

Chapter 13: Extended Library Features Import and Export from External Sources

The field names are the column headers with the field values filling in the table contents.

Step 4: Cross Linking the Files

To cross link the MRP file with the P-CAD sample library:

1. From the Table menu of the MRP file Viewer, choose Cross Link to open the Cross Link dialog.

2. In the Select Source Fields to Cross Link box, select the box to the left of the Part Number field name.

3. In the Select Target Library/Set to Cross Link box, select the library Ale_tutor.lib file under DEFAULT_LIBRARY_SET.

4. Click OK. The Cross Link Result Viewer appears with the combination of the library and source file information for components with matching Part Number attributes.

Import and Export from External Sources Chapter 13: Extended Library Features

5. In the Viewer table, there are two columns containing values for the Quantity attribute: one from the source and one, with the header TARGET:Quantity, from the library. The same is true for the Vendor and Cost attributes.

Select the column TARGET:Quantity by clicking the header. While holding the SHIFT key, click and hold the left mouse button and drag the column until a black line appears adjacent to the Quantity column. Release the mouse button and the TARGET:Quantity column is placed next to the Quantity column.

6. With the two columns containing component Quantity information adjacent to each other you can visually compare changes in inventory.

Select the TARGET:Quantity, TARGET: Cost and TARGET:Vendor columns by clicking the column headers with the SHIFT key pressed. Click DELETE to eliminate the original library Quantity values. The updated attribute values are in the file Viewer and ready to be saved.

Step 5: Updating the Library

1. Update the Library by choosing the Save to Library command from the Table menu to open the Save Source dialog.

2. Select the Update option button.

3. Click the Library button, navigate to the Tutorial folder in the P-CAD installation directory and select the Ale_tutor.lib library. Click Open. The selected library name displays in the edit box.

There are no new components in the imported MRP file. Leave the Create new components box cleared.

Since the MRP file does not contain a ComponentLibrary attribute, leave the Update only components with matching library name box cleared.

Chapter 13: Extended Library Features Import and Export from External Sources

4. Select the Create component time stamps if not present check box when adding or updating the ModifyDate attribute in the component library.

5. Select the Source check box only to the right of the attribute Quantity, since only that attribute will be updated.

6. Click Ignore to the right of all remaining attributes.

7. Click OK.

Notice that the Cost attribute for many of these components has changed. You will be updating the component Cost in lesson 3.

Related documents