Preparing to import PDXpert file attachments

Last update 2017-06-30

Applies to PDXpert PLM server software release 8.0 and later. PDXpert 7.x is similar, but the importer column headers are different.

PDXpert PLM software file attachments import process

PDXpert includes an External Data Importer tool that allows you to initialize your new PLM system by importing existing document and part records, and then attaching files to these records.

The CSV file used for importing file attachments includes separate columns for item files and revision files (as well as external links). An item record in your PLM database can have more than one file imported into any (or all) of these file lists.

Each file contained in the import CSV file is copied from the specified location to the PDXpert library. The file attributes are extracted, and then listed on the item record's Files list.

The imported file must be listed within the appropriate CSV column. For example, if you're importing files assigned to item revision records, then the RevisionFile is a required value. It must be a fully-qualified folder and filename to a local drive or a network share; relative paths aren't supported.

Obtaining an inventory of files for import

The first step is to create a text file that contains all files of interest.

  • Import your files from a local disk drive to avoid network errors and reduce import time. If your files are on a network share or cloud repository, copy them onto a computer where the PDXpert client is installed.
  • To simplify editing the inventory list, all files that you want to import should be within a single folder (which may include any subfolders).
  • PDXpert imports individual files, so all import paths must ultimately terminate in an actual file, not simply a folder.

The following Windows DOS command extracts all visible, non-system filenames within the current directory and its subdirectories:

D:\path>dir /A:-D-H-S /O:N /S /B > _ListFiles.csv

To create a more complete starting CSV import file, including the quoted file path:

  • Copy the following DOS commands into a new _GetFileInventory.bat file.
  • Or, download this prepared file. To run the DOS command file, first edit the filename from _GetFileInventory.bat.rename to _GetFileInventory.bat. Windows may warn about running this file, but you can allow it by opening the file Properties and marking the Security:  Unblock checkbox.

@ECHO off

REM 2017-04-11: Generate list of all files as quoted CSV, with import headers

REM 2017-06-30: Datetime independent of local format; exclude .BAT from list

 

SET filename=!_ListRevisionFiles.csv

REM Check WMIC is available

WMIC.EXE Alias /? >NUL 2>&1 || GOTO s_error

REM Use WMIC to retrieve date and time

FOR /F "skip=1 tokens=1-6" %%G IN ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /Format:table') DO (

 IF "%%~L"=="" GOTO s_done

  SET _yyyy=%%L

  SET _mm=00%%J

  SET _dd=00%%G

  SET _hour=00%%H

  SET _minute=00%%I

  SET _second=00%%K

 )

:s_done

 

REM Pad digits with leading zeros

 SET _mm=%_mm:~-2%

 SET _dd=%_dd:~-2%

 SET _hour=%_hour:~-2%

 SET _minute=%_minute:~-2%

 SET _second=%_second:~-2%

 

REM Format as ISO 8601 datetime:

SET _isodate=%_yyyy%-%_mm%-%_dd%T%_hour%-%_minute%-%_second%

SET filename=!_ListRevisionFiles_%_isodate%.csv

:s_error

ECHO RevisionFile,Class,Owner,Type,Number > %filename%

ATTRIB +H %0

ATTRIB +H %filename%

FOR /r %%a IN (*.*) do ECHO ^"%%a^" >> %filename%

ATTRIB -H %filename%

ATTRIB -H %0

ECHO.

ECHO The output file '%filename%' is now

ECHO located in the same folder where you saved '_GetFileInventory.bat'

ECHO.

PAUSE

Place the _GetFileInventory.bat batch file into the root folder of the local file library, and run (double-click) it to obtain your file inventory in a _ListFiles.csv text file.

Modifying the inventory file

The batch file treats the Revision Files list as the most likely destination for your imported files. You can instead modify the batch results to import into the Item Files list, or split the file into separate item/iteration batches.

First, clean up the inventory CSV file using a CSV editor, plain text editor, or possibly Microsoft® Excel®.

  • Delete any files that you don't want to import.
  • Ensure there are no duplicate file names matched to a specific item record.
  • Verify that the column headers conform to PDXpert's import specification.

There are two remaining tasks for converting your file inventory into a valid PDXpert CSV import file.

  1. Add or derive the item record identifiers for the Class, Owner, Type and Number columns as needed. Populate the item identifier columns by extracting folder and filename data using PowerShell, Excel, or other scripting tool.

    The External Data Importer tool seeks an existing PDXpert item record. If there is no matching item record, the file will not be imported.

    If there are no item records for some files, create a simple ItemMaster.csv file using the same Class, Owner, Type and Number columns, with the filename as the item Description column. See the Item Master import for requirements.

    A Revision column isn't needed in the import file because the item record is allowed only one iteration — which must be pending.

  2. Specify where each file belongs in the matched item record ? either to the item or the pending iteration. The ListItemFilesLinks.csv or ListRevisionFiles.cs file column must include a complete and accurate file path and name.

    Do not import a revision-level file to an item that has previously been released.

    The actual name of the imported file is irrelevant to the attachment process. For example, a file listed in ListRevisionFiles.csv is attached to the current pending iteration, regardless of the pending iteration's displayed Revision value.

Final comments

Use caution if editing your CSV file with Excel. It may attempt to "repair" item identifier values, such as dropping leading zeroes (00123 becomes 123) or calculating results (1234-1 becomes 1233).

For other important information on creating a valid file for attaching files to PDXpert items, see the PDXpert application help topics How to report, import & export > Import & update items >

  • Use the External Data Importer (on line)
  • Item Master import format (on line)
  • Item files & links import format (on line)
  • Revision files import format (on line)

It may be helpful to review the Import part, document, file data tutorial, as well.

This application note was relevant to the PDXpert software release that was current at time of publication. Product changes since that time may affect its utility. We'd be happy to assist you in assessing the applicability of this note to your situation.

Learn More
Application Notes
Working within PDXpert
Working with other software applications