DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

getting channel comments from 8.1 data navigator

Hello When comparing several DIAdem measurements, all channels that I want to compare frequently have the same name, e.g. leakage rate. So, when I select 15 leakage channels from 100 measurement files via data navigator, I have no indication, which measurement each channel came from - it's just 15 channels named 'leakage'. However, I could try to get a dataset attribute from all the selected *.dat files, and maybe put this into channel comment. It seems to me that something along the ODSValGet function might help, but I have never got a hook onto it. Does anyone have an idea how to solve this? Thanx in advance Michael
0 Kudos
Message 1 of 4
(3,828 Views)

Hi Nimic,

For the particular case of DAT files, there exists a function to read out properties from the file without loading it-- here is an example which reads out all the Data Set properties from an example DAT file that ships with DIAdem 8.1:

Call DataLoadHdFile(ProgramDrv & "Demo\DAT\Drive.DAT")
Msg = Msg & "FileHdTitle = "     & FileHdTitle     & vbCRLF  ' Data Set name
Msg = Msg & "FileHdAuthor = "    & FileHdAuthor    & vbCRLF  ' Data Set author
Msg = Msg & "FileHdDate = "      & FileHdDate      & vbCRLF  ' Data Set date
Msg = Msg & "FileHdTime = "      & FileHdTime      & vbCRLF ' Data Set time
Msg = Msg & "FileHdNov = "       & FileHdNov       & vbCRLF  ' value used as "NoValue" in DATA
Msg = Msg & "FileHdByteOrder = " & FileHdByteOrder & vbCRLF ' "Big Endian" or "Little Endian"
Msg = Msg & "FileHdFontName = "  & FileHdFontName  & vbCRLF ' Data Set font name used in DATA
Msg = Msg & "FileHdFontSize = "  & FileHdFontSize  & vbCRLF  ' Data Set font size used in DATA
FOR i = 1 TO DataSetMaxComm
  Msg = Msg & "Comment(" & i & ") "  & FileHdCommentN(i) & " = "  ' Data Set comment name (j)
  Msg = Msg                          & FileHdComment(i)  & vbCRLF ' Data Set comment (j)
NEXT ' i
MsgBox Msg

Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 2 of 4
(3,818 Views)
Hello, Brad
Thank you for your reply. I see that I can access the information from the dat files.
However, my hope was to use the Data Navigator of DIAdem 8.10, particularly the import function that transfers all selected measured channels to the DIAdem data module.
The approach you suggested requires using list files to select the measurements (and these list files need to be generated, which is a little cumbersome), whereas the 'Navigator approach' permits a quicker change of data sets.

anyway - I'll try to follow the lead.

Michael
0 Kudos
Message 3 of 4
(3,743 Views)
Theer is a script called Ods2Dia.vbs which is used to load the channels from the DataNavigator.
At some point ther is a OdsChannelGet method called which loads the data.
At this point a script extension like the following one can load additional information.
To polay around with this sniplet you can attach it to one of the three buttons
in the DataNavigator select a channel and press the button.

Greetings Andreas



Option Explicit  'Forces the explicit declaration of all the variables in a script.

if odscurrcount > 0 then

  dim handle : handle = odscurrhandle
  dim channel : channel = OdsCurrMarked(1)
  OdsValAlloc "DiaComments", "ODS_TYPE_INST", 100 : Check

  ' Walk from channel to matrix
  OdsSValGet channel, "measurement", "ODS_TYPE_INST", handle : Check
  dim diaMatrix : diaMatrix = OdsSValInst
 
  ' Get the list of datasetcomments
  OdsValGet diaMatrix, "dataset_comments", 1, 0, "ODS_TYPE_INST", "DiaComments", 1, handle : Check
  dim numOfComments : numOfComments = OdsValCount

  dim txt : txt = ""
 
  ' loop over comments and get name and value
  dim commentIndex : for commentIndex = 1 to numOfComments
 
    OdsSValGet DiaComments(commentIndex), "name", "ODS_TYPE_STRING", handle : Check
    txt = txt & OdsSValString & " | "

    OdsSValGet DiaComments(commentIndex), "description", "ODS_TYPE_STRING", handle : Check
    txt = txt & OdsSValString & VBCRLF

  Next

  MsgBox txt

end if

Sub Check

  if 0 <> odsstat then

    OdsStatusMsg odsstat, 1
    AutoQuit    

  end if

End Sub
0 Kudos
Message 4 of 4
(3,721 Views)