09-25-2017 02:44 AM
Hi,
I do have an excel file with channel names. I would like to load certain file to data portal and check if all the names from that excel file are present as a channels in the loaded file. And if there are missing channels, I would like to show message box with the channel names which are not present.
Any help appreciated.
Thanks
Jan
Solved! Go to Solution.
09-25-2017 04:40 PM
Hi Jan,
How should your script know which channel names to expect for each data file loaded? Is the channel name list always the same for every file?
Brad Turpin
Product Support Engineer
National Instruments
09-26-2017 01:59 AM
Hi Brad,
Thanks for your reply,
Yes the channel name list would be always the same (list in excel). It is just to check if the file loaded includes all the channel names.
It is a pre check before running automated calculation on the file, so it is not time wasted.
Many thanks
Jan
09-26-2017 11:58 AM
Hi Jan,
It sounds like there are 2 distinct tasks:
1) Load your list of expected channel names from your Excel file
2) Loop through that list of channel names to makes sure they're all present in the Data Portal
I'm going to guess that you want help with both of these. In that case, can you post an Excel file with the list of channel names in it and one of your data files? I can then send you a VBScript that performs 1) and 2) above.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
09-27-2017 02:35 AM
Hi Brad,
Thank you for getting back to me so quickly.
I am able to load in an excel file with channel names, but just in case find attach the excel file.
What I struggle more is the script for comparison to the file loaded, and showing an text document wich would say what channels/signal names are missing from the .tdm file. Please also find attached the .tdm file. The .tdm files will be most probably missing most of the channels as the files with mostly all channels in are too big to upload.
Many thanks for help.
09-27-2017 03:29 PM
Hi Jan,
Please also post the *.TDX file that goes with that *.TDM file. I can't load the *.TDM file without its partner *.TDX file.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
09-28-2017 03:15 AM
Hi Brad
Unfortunately when I tried to attach .tdx I got an error.
I try again with zipped folder.
Jan
09-29-2017 09:58 AM
Hi Jan,
OK, you need to detach and double-click the *.uri file below to register the DataPlugin that reads your Excel file of channel names. Then you need to adjust the below VBScript to point to the correct DataFilePath and ListFilePath locations on your computer. Then run this VBScript in the SCRIPT panel of DIAdem.
Option Explicit Dim n, i, iMax, DataFilePath, ListFilePath, ListGroups, ListChannel, FoundChannel, MissChannels DataFilePath = CurrentScriptPath & "2HJVP218_CAN_FR_CCP_Data 2017-08-01 07-37-00-536847 Partition 0.TDM" ListFilePath = CurrentScriptPath & "D4H.xlsx" Call Data.Root.Clear Call DataFileLoad(DataFilePath, "TDM") Set ListGroups = DataFileLoad(ListFilePath, "JanSantoraList_XLSX") Set ListChannel = ListGroups(1).Channels(1) n = -1 iMax = ListChannel.Size ReDim MissChannels(iMax) LogFileWrite "Found Channels" LogFileWrite "-----------------" FOR i = 1 TO iMax FoundChannel = "" On Error Resume Next Set FoundChannel = Data.GetChannel("*/" & ListChannel(i)) On Error Goto 0 IF NOT IsObject(FoundChannel) THEN n = n + 1 MissChannels(n) = ListChannel(i) ELSE LogFileWrite ListChannel(i) END IF NEXT ' i ReDim Preserve MissChannels(n) MsgBox "Missing " & n+1 & " Channels" & vbCRLF & String(25, "-") & vbCRLF & Join(MissChannels, vbCRLF)
Brad Turpin
DIAdem Product Support Engineer
National Instruments
10-03-2017 02:17 AM
Hi Brad,
Thank you very much for your help. It works perfectly.
Jan