How to Parse File Name on the DIAdem Report

Updated Mar 10, 2018

Reported In


  • DIAdem

Issue Details

I have a large number of files I need to process in DIAdem. The file names have the data and serial number information in the file name. For example, the files are named with the following format:

I would like to parse this out to include it in different parts of my report in DIAdem.


This can be done using the Split VBS method. This method outputs an array of all segments of a string that are separated with a specific delimiter. In the example given in the Issue Details, the delimiter would be the underscore symbol ("_").

According to the Split topic in the DIAdem Help, the syntax is:
Split(expression, [delimiter], [count], [compare])

where expression must be replaced with the file name as a string. Refer to the Split topic in the DIAdem Help for more details about the method, as well as an use example in a script.

If you don't want to write a script, but use the method directly in the Report pane in DIAdem, for example, as part of the label of a 2D Axis System, you can enter the method as follows:
@@Split(expression, [delimiter], [count], [compare])(i)@@

where i is the component index. Since the output of the Split method is an array, you need to add an index to extract each value independently. Using the example from the Issue details:
@@Split("DUT_SerialNumber_Date_TestTime", "_", -1, vbTextCompare)(i)@@

would return:
i valueExpression Output

Additional Information

  • If you don't want to write the name of the file manually, you can use the Data.Root.Name, Root property, as the expression input of the Split method.
  • You can load and unload files to the Data Portal using the DataFileLoad command and the Remove method.
  • If you want to repeat the process for multiple files automatically, the easiest method would be creating an array with all the paths, or placing all the files in a single directory and using the DirListGet command, which will return an array of file names from a directory you specify. Then, you can combine it with a for For Each...Next control structure to iterate the process once for every file.


Not Helpful