DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Exporting and Loading Group, Channel, and PROPERTIES

I am wanting to load all groups, channels, and their properties from a .txt file. It seems when I save my .tdms file as a .txt it only saves the channel names. Is there a way to save/export all the associated info of the group -> channels->properties to a .txt or other ASCII format to be edited and  then load/import back into DIAdem?

I have created DataPlugins to pull in group, channel, and data from an ASCII format, but cannot figure out how to pull in properties of the group/channel.

I basically want a repository containing all information of the DIAdem file to where I can load it into the data portal without having to add properties afterwards.

0 Kudos
Message 1 of 6
(916 Views)

It would be nice to have a plugin to pull properties from a text file... I never got to figuring that out but I am using some scripts to do that.  I can show you how if you can post a small file with fake properties that is structured similarly to the files you are working on.

0 Kudos
Message 2 of 6
(840 Views)

Thank you for the response. The properties are structured such that LabVIEW will cycle through each Group and Channel pulling out the properties to populate the associated sequence in TestStand. We use the LabVIEW structure to populate arrays containing specifics for the tests quickly. We have multiple DIAdem files of which the later ones will contain actual values rather than just the TestStand sequence like the ones I attached.

Download All
0 Kudos
Message 3 of 6
(831 Views)

OK so I am still not sure what exactly you need.  I use a script that reads lines off a txt file which I will post below.  I also use a script for reading/writing values to and from Excel spreadsheets.  Let me know if this is getting closer to what you're looking for

'-------------------------------------------------------------------------------
'-- VBS script file
'-- Created on 09/26/2017 15:00:56
'-- Author: Gleb Sklyr
'-- Comment: Function to return specified lines  with a separator off a text file
'-------------------------------------------------------------------------------
Option Explicit  'Forces the explicit declaration of all the variables in a script.

DIM SUB_NAME, FSO
Set FSO = CreateObject("Scripting.FileSystemObject")

' READ LINES OFF A TEXT FILE
' ARG 1: Path of the text file
' ARG 2: Start line to read
' ARG 3: End line to read
' ARG 4: The regular expression to separate each line
' RETURN: String with specified lines separated by VBCRLF
' NOTES: If lineEnd = -1 then will read till the end of file
Function readLines(txtPath, lineStart, lineEnd, regx)
  SUB_NAME = "readLines" & ": "
  Call LogFileWrite(SUB_NAME & "Started exeution")
  ' START
  If FSO.FileExists(txtPath) Then ' Check path exists
    If TypeName(lineStart) = "Integer" Or TypeName(lineStart) = "Double" And TypeName(lineEnd) = "Integer" Or TypeName(lineEnd) = "Double" Then ' Check valid ARGS
      If lineStart > 0 And lineEnd >= -1 And Not lineEnd = 0 And ((lineStart <= lineEnd) Or (lineStart > 0 And lineEnd = -1))Then ' check logical line start/end
        Dim txtFile, outputStr, lineCount, i
        Set txtFile = FSO.OpenTextFile(txtPath)
        outputStr = ""
        lineCount = lineStart
        For i = 1 To lineStart - 1 Step 1 ' Skip lines till start line is reached
          txtFile.SkipLine()
        Next
        If lineEnd = -1 Then ' If -1 then read till the end of file
          Do Until txtFile.AtEndOfStream ' Loop every line till the last line
            outputStr = outputStr & txtFile.ReadLine() & regx
          Loop
        Else
          Do Until lineCount = lineEnd + 1 ' Loop every line till the requested line
            outputStr = outputStr & txtFile.ReadLine() & regx
            lineCount = lineCount + 1
          Loop
        End If
        readLines = outputStr
      Else
        Call LogFileWrite(SUB_NAME & "Line start and line end arguments are not logical... Aborting")
      End If
    Else
      Call LogFileWrite(SUB_NAME & "Line start and line end arguments must be integers or doubles... Aborting")
    End If
  Else
    Call LogFileWrite(SUB_NAME & "Provided text file path is invalid... Aborting")
  End If
  ' END
  Call LogFileWrite(SUB_NAME & "Ended exeution")
End Function



' EXAMPLE USE
Dim FileStr, FileArr, i
FileStr = readLines("C:\Users\111660\Desktop\ex.txt", 1, -1, VBCRLF)
FileArr = Split(FileStr, VBCRLF)
For i = 0 To UBound(FileArr, 1) Step 1
  Call LogFileWrite(FileArr(i))
Next

Attached is an example file and the code in the very button is an example of how to use the readlines function.  You will have to change the path of the file to match yours.  I log the values into the logfile in the example but you can take them and break them down by ":" and assign property-value pairs to channels/groups

0 Kudos
Message 4 of 6
(820 Views)

Lets try this.. Do you know a way to export the .tdms file from DIAdem into a .txt or .csv wherein the properties are included?

0 Kudos
Message 5 of 6
(812 Views)

No... I would suggest either keeping a data file and a properties file or add the properties to the top of the file after saving the data.  You'd have to come up with a good format to save File/Group/Channel properties so that it would be easy for you to process/interpret.  Ideally, just save the data as TDMS and have scripts to process the data into TDR template (PDF reports).  That way data is always available and searchable by properties and you can use the script anytime to generate a user readable report report.

0 Kudos
Message 6 of 6
(805 Views)