Attaching files - SmartPlant Foundation - IM Update 48 - Help - Hexagon

SmartPlant Foundation Help

Language
English
Product
SmartPlant Foundation
Search by Category
Help
SmartPlant Foundation / SDx Version
10
SmartPlant Markup Plus Version
10.0 (2019)
Smart Review Version
2020 (15.0)

To upload and attach a file, two NLF statements are required. The first is an upload instruction to move the physical file from the local host to a server. The second is the file object itself, which represents the meta-data that is created in the database.

.UploadInstruction

..RefClass|SPFAuthAdapterFile

..RefName|ToolMapSchema_PBSFile

..RemoveLocalFileInd|False

.SPFAuthAdapterFile

..Name|ToolMapSchema_PBSFile

..SPFLocalDirectory|C:\

..SPFLocalFileName|ToolMapSchema_PBS.xml

..ISPFDBFile

The upload instruction needs to reference the associated file for the transfer to be successful. For files that end up in the database, the interface ISPFDBFile needs to be referenced; if it is a file that ends up in the vault, then a vault needs to be referenced.

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 attached file is specified in the SPFLocalFilename property, the Loader looks for the file only in the full path.

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

To automatically create the next version and attach the document to this instead, use the instruction CreateNewVersionIfExists as shown in the following example:

.SPFTemplateFile

..Name|XLS_Tag_Data_1

..SPFLocalDirectory|C:\

..SPFLocalFileName|XLS Tag Data 2.xls

..ISPFDBFile

..SPFTemplateVersion|XLS_Tag_Data|SPFFileComposition_12

..Action|CreateNewVersionIfExists

To automatically attach multiple files to an object, use the following NLF statement:

.SPFDesignDocMaster

..Name|Doc_PlantA

..Action|AttachFile|C:\UploadFile1.txt, C:\UploadFile2.txt|SPFDesignFile|False|Replace

In the previous example, SPFDesignFile objects are created and attached to the latest document version Doc_PlantA. The files are uploaded from the specified paths. If a file with the same name already exists on the given document version, the file is replaced based on the Replace option specified. If the document Doc_PlantA does not exist and relationships required to create the document are available, the document is created and files are attached to it.

For more information, see NLF instructions.