02-02-2021 05:03 AM
I often run into the problem that people ask mee to process some data but that the channel names are completely different (but is physical the same signal) and that stops my script.
I'm wondering if it is possible that when one channel name is not found that it can search for a second name in that same file. In this way i can make a list of channel names that are actual the same (due to bad naming conventions).
02-03-2021 05:05 PM - edited 02-03-2021 05:06 PM
Hi ServieBaart,
Are you talking about changing the names of certain channels after loading all the channels of a given file into the Data Portal, or are you actually trying to selectively load certain channels from the file, by channel name?
There is a feature in DIAdem, I believe, similar to the Data Preprocessor in SystemLink, where you can specify channel name mappings to be applied while you load the file into the Data Portal. I haven't ever used that in DIAdem, but I could look into it if that sounds like it's what you're looking for.
Brad Turpin
Principal Technical Support Engineer
NI
Brad
02-04-2021 01:06 AM
Hey Brad! Thank you for the reply 😁
I'm already loading certain channels from files with "Call DataFileLoadSel()" since the file channels are never 100% the same and mostly i need to load some channels from multiple files sequentially (total data set goes up to 400GB, so I cannot load everything at once).
Problem is when the file name is not 100% the same, then it will not find it the channel and stops the script.
I don't have any experience with SystemLink, It will extremely help mee when you could direct mee to that feature in Diadem.
02-04-2021 04:38 PM - edited 02-04-2021 04:40 PM
Hi ServieBaart,
The loading-with-property-mapping feature in DIAdem works when you load all the channels of a file or a group, or when you load selected channels by channel index. But if you need to load selected channels by channel name, and if those selected channel names have aliases strewn among the files you want to load from... well that doesn't work. I have prepared an example script application that shows how you can create a ValueMappingFile (*.tpvm) and invoke it from the ImportParameter of the load command. I included 2 ways of referencing the selected channels to load-- hopefully one of those works for you. You can also request all the channels of a group by using "GroupName/*" or "[GroupIndex]/*".
Regards,
Brad Turpin
Principal Technical Support Engineer
NI
02-05-2021 01:27 AM - edited 02-05-2021 01:31 AM
Hey Brad!
Thank you for the feedback.
But i'm not sure it contains the correct info for mee.
I do found a possible solution for my problem by "capturing" the error.
- I let the code continue with "On Error Resume Next" on an error.
- The I use the "Err.Number" to selective load with another name.
- Before I try another channel name i set the "Err.Number" back to 0.
- Finally I clear the "On Error Resume Next" functionality with "Call Err.Clear()" so the rest of my code works as normal.
Code:
On Error Resume Next
Call DataFileLoadSel(FileName, "", "*/" & "WrongName", "")
If Err.Number <> 0 Then
On Error Goto 0
Call DataFileLoadSel(FileName, "", "*/" & "CorrectName", "")
End If
Call Err.Clear()
I found hints for solution here, so also thank you for that 😁 :