Attaching files (XML) - HxGN SDx - Update 63 - Administration & Configuration

Administration and Configuration of HxGN SDx

Language
English
Product
HxGN SDx
Search by Category
Administration & Configuration
SmartPlant Foundation / SDx Version
10

A reference must be made to the object when a file is being attached. There are two different types of files that you can attach to two different documents:

  1. <SPFTemplateFile> to an <SPFTemplateVersion>

  2. <SPFDesignFile> to an <SPFDesignDocVersion>

Several XML statements are required to upload and attach a file:

  • The upload instruction to move the physical file from the local host to a server.

  • The file object created representing the meta-data that gets created in the database.

  • The relationship that an object references from the file being attached.

Upload instruction

Template file

<SPFUploadInstruction>

<ISPFUploadInstruction FilePath="Instrument List Template.xls" RemoveLocalFileInd="False"/>

<IRefObject RefClass="SPFTemplateFile" RefUID="InstrumentListTemplateFile" RefName="InstrumentListTemplateFile" />

</SPFUploadInstruction>

Design file

<SPFUploadInstruction>

<ISPFUploadInstruction FilePath="PID1.pid" RemoveLocalFileInd="False"/>

<IRefObject RefClass="SPFDesignFile" RefUID="PID1File" RefName="PID1.pid" />

</SPFUploadInstruction>

  • The Upload Instruction references the associated file for the transfer to be successful.

  • The "RefUID" in the Upload Instruction needs to match the "UID" in the File Object Statement.

  • The interface ISPFDBFile needs to be referenced in the File Object Statement for files that end up in the database.

  • The vault needs to be related to the file object for files that end up in the vault.

  • We recommend that you remove the interface requirement and allow the system to determine if the file is added to the database.

  • If the full path to an attaching file is specified in the SPFLocalFilename property, the Loader only looks for the file in the full path.

  • If a relative path is specified in the SPFLocalFilename property, the Loader first looks for the attaching file in the relative path where the load file resides. If the attaching file is not found, then the Loader looks for it under the directory specified for the SPFLocalDirectory property.

File object statement

Template file

<SPFTemplateFile>

<IObject Description="Instrument List Template File" Name="Instrument List Template File" UID="Instrument List Template File" />

<ISPFAlternateRenditionComposition />

<ISPFFile SPFLocalHostName="localhost" SPFLocalDirectory="C:\" SPFLocalFileName="Instrument List template.xls" />

<ISPFBusinessFile SPFEditInd="True" SPFViewInd="True" SPFIsFileCheckedOut="False" />

<ISPFNavigationFileComposition />

<ISPFRefFile />

<ISPFTemplateFile />

<ISPFDBFile />

</SPFTemplateFile>

Design file

<SPFDesignFile>

<IObject Description="Type is PID" Name="PID1.pid" UID="PID1File" />

<ISPFAlternateRenditionComposition />

<ISPFFile SPFLocalHostName="localhost" SPFLocalDirectory="C:\" SPFLocalFileName="PID1.pid" />

<ISPFBusinessFile SPFEditInd="True" SPFViewInd="True" SPFIsFileCheckedOut="False" />

<ISPFAlternateRenditionComposition />

<ISPFMarkupComposition />

<ISPFDesignFile />

<ISPFOwnedObj />

<ISPFRefFileComposition />

<ISPFFTRItem />

<ISPFSubscribableItem />

<ISPFRefFile />

</SPFDesignFile>

<Rel>

    <IObject UID="PID1File.SPF40" Name="" Description="" ContainerID="" />

<ISPFClaimableItem" />

<IRel UID2="VLT_SPF40Vault" UID1="PID1File" DefUID="SPFFileVault" />

  </Rel>

Relationship to attach a file to an object

All files must be related to an object that has an ISPFFileComposition interface definition, typically Document Versions and Transmittals.

Template file

<Rel>

    <IObject UID="InstrumentListTemplateFile.InstrumentListTemplateVersion" />

    <IRel DefUID="SPFFileComposition" UID2="InstrumentListTemplateVersion" UID1="InstrumentListTemplateFile" />

  </Rel>

Design file

<Rel>

    <IObject UID="PID1File.PID1DesignDocVersion" />

    <IRel DefUID="SPFFileComposition" UID2="PID1DesignDocVersion" UID1="PID1File" />

  </Rel>

If no relationship is given for a specific file type, then one is allocated.