DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Loading multiple files within a data plugin

Solved!
Go to solution

Hello,

 

I'm working on a Data plugin to add custom properties to files but those properties are stored in a separate file within the same folder.

Is it possible to load an extra file inside of a data plugin ?
I basically want my data plugin to load the selected file inside of data portal like a simple data plugin would do but also load a specific file in my data portal at the same time, it is possible ?

 

I tried adding : 

call DataFileLoad("fullFilePath") that return error because  dataFileload does not work in VBS dataplugin 

 

and 

 

Dim oFile
Set oFile = OpenFile("fullFilePath")  that does not make error but still does not load file in dataportal

 

I found an old post about this but it does not work for me :

https://forums.ni.com/t5/DIAdem/Using-DataFileLoad-inside-a-dataplugin/td-p/3271400

 

Thanks for the help.

 

0 Kudos
Message 1 of 3
(527 Views)

Running:

 

Dim oMyFile : Set oMyFile = OpenFile("c:\test.txt")

 

 Is not supposed to pull anything into the data portal, it just creates a File object.  You can work in script to parse that files properties/contents and add them to your data.  You can type "openfile" in diadem script help to find more information on OpenFile() method, File object and other related commands, pretty good detail:

 

gsklyr_0-1676911267192.png

 

0 Kudos
Message 2 of 3
(510 Views)
Solution
Accepted by topic author Clement_depres

Thanks for your answer

I looked into it and found something similar using :

 

Dim oExcelFile

Set oExcelFile = OpenSpreadsheet("c:\test.xlsx")

Dim oCurrSheet: Set oCurrSheet = oExcelFile.Sheets(1)

Dim oCellValue: oCellValue = oCurrSheet.GetCellValue(5,2)

call Root.Properties.Add("Generic_Metadata~ID", oCellValue)

This  let me harvest data from an other xlsx file and implement them as properties to my main file within dataplugin

0 Kudos
Message 3 of 3
(488 Views)