ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Call Data.Move changes data

Solved!
Go to solution

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

0 Kudos
Message 1 of 4
(2,993 Views)
Solution
Accepted by topic author Chris123123

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

0 Kudos
Message 2 of 4
(2,962 Views)

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.  

Message 3 of 4
(2,932 Views)

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

 

0 Kudos
Message 4 of 4
(2,949 Views)