This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SUPPORT Q&A - Import Data (with file attach for thumbnail)

Anonymous - Sunday, May 12, 2013 3:36 AM:

Hi All,

I am new in Aras, understand there is a tool - NASH to import data to the database. My question is that can we also import the file also.

Example: ItemType - "PART"

How can we attach the picture (jpg file) on the property filed  of  thumbnail under Item "Part"?

 

thank you



Brian - Thursday, May 16, 2013 12:22 AM:

Hi Alex,

I don't think you can do this in one import.

You might be able to do it by first importing all of the Files that are going to be the thumbnails.

Then get a listing of these including the File id and file name.

Then update the "thumbnail" property to point to the file id.

Thumbnail format is: <thumbnail>vault:///?fileId=E7CBECB6C2FE4836BC8165A8C783960F</thumbnail>

Hope this helps,

Brian.



Anonymous - Monday, May 27, 2013 2:49 PM:

Hi Brain,

Thank you for your reply. May I know how to importing all the Files at a time?

 

Alex AYC



Brian - Tuesday, May 28, 2013 9:00 PM:

Hi Alex,

It turns out you can't import files using NASH.

However, you can write a simple client side method that is run by an Action which reads a file with the names of Files you want to put into Innovator.

Create an XML file with a format like this:

<?xml version="1.0" encoding="utf-8"?>
<Files>
<file>d:arasdatainput ew test document1.docx</file>
<file>d:arasdatainputNew Word Document1.docx</file>
<file>d:arasdatainputOpen new document1.docx</file>
<file>d:arasdatainput eport1.doc</file>
</Files>

Create a new method - Client side, BLOCKED SCRIPT

Paste this code into it:

// vault files from a list supplied by the user.

 

var vlt = top.aras.vault;

var inn = this.getInnovator();

// open the file to read the list

 

var filePath = vlt.SelectFile();

  if (filePath === undefined || filePath === ''){

      return false;

 }

var res = vlt.FileOpenRead(filePath);

 

var contents = vlt.ReadText(filePath);

 

var xmlDoc = inn.newXMLDocument();

xmlDoc.loadXML(contents);

 

var files = xmlDoc.selectNodes("//file");

// loop through the upload file and create a File record for each 

// file listed in the upload file

for ( var i = 0; i < files.length; i++){

    var fileItem = this.newItem("File","add");

    fileItem.setFileName(files[i].text);

    fileItem = fileItem.apply();

}

vlt.FileClose();

Create a new Action and select the method you just created.

Make action type = Generic.

When you run the action you will be prompted for the input file name (this is the xml file with the list of files to upload).

Select the input file and click "Open"

It should read all of the file names and put the actual files into the vault.

Hope this helps,

Brian.

 



Anonymous - Tuesday, May 28, 2013 9:25 PM:

Hi Brian,

Thank you so much. I will take a try on the above  solution.

Thank you.

Alex AYC