10-20-2021 01:53 PM
When run the following script the data changes, to like 3E+282
But only when that TDMS file is in a very specific location...no idea what's going on!
code:
Call DataFileLoad("C:\Data\temporary_tdms.tdms") 'Loads the example data set
sum_of_files = 0
for indexgroup = 1 To GroupCount
my_groupname = GroupName(indexgroup)
if right(my_groupname,3) = "_TA" Then
sum_of_files = sum_of_files + 1
'swap if necessary
if indexgroup <> sum_of_files Then
Call Data.Move(Data.Root.ChannelGroups(indexgroup),Data.Root.ChannelGroups,sum_of_files)
End If
End If
next
Solved! Go to Solution.
10-21-2021 01:21 AM
Hi Chris123123,
Please excuse, but I did not fully understand the problem. Do you mean that the values of a channel changing after moving the channel group? Can you provide an example, like the original file and the file after moving the group?
By the way, you have a mix of old commands and the Data-API. I you would like to use only the new Data-API your script looks like this:
dim indexgroup, my_groupname, oGroups, sum_of_files
set oGroups = Data.Root.ChannelGroups
sum_of_files = 0
for indexgroup = 1 To oGroups.Count
my_groupname = oGroups(indexgroup).Name
if uCase(right(my_groupname,3)) = "_TA" Then
sum_of_files = sum_of_files + 1
'swap if necessary
if indexgroup <> sum_of_files Then
Call Data.Move(oGroups(indexgroup), oGroups, sum_of_files)
End If
End If
next
Greetings
Walter
10-21-2021 06:23 AM
So apparently moving data does NOT change data after all.
Root cause was a corrupt tdms_index file (attached).
I copied the tdms file to other locations (without _index file) and I did not see that behavior.
I didn't pay attention to that _index file so I (wrongly) assumed that Data.Move was the cause.
Not sure how it got corrupted, I attached it if it's of any value.
Thank you for the new Data-API code, I will use that instead.
10-21-2021 06:30 AM
Turns out I had a corrupt _index file
I will use the new code, thank you for that!
If it's of any help:
Attached the original tdms, corrupted _index file and tdms after importing with corrupt _index file