10-21-2014 08:02 AM
Hello,
i have 805 groups in my data and in some cases there are less then 805 groups (for example 801).
now i have a script for deleting all groups except the first group.
my problem is:
If in my data are only 801 groups, the script stops and say (i use an invalid value: allowed are values form 0 to groupcount)
how can i solve this problem?
here is the scirpt i use for that:
number = 2
for gruppe = number to 809
do
number = number+1
if zahl <= 809 then
Call GroupDel(gruppe)
call msglinedisp("delete group Nr. "+str(zahl))
end if
loop until (number>809)
hope anyone can help.
thank you
Solved! Go to Solution.
10-22-2014 12:58 AM
Hi portas,
why don't you write someting like this:
dim i
for i=2 to groupcount
Call GroupDel(groupcount)
call msglinedisp("delete group Nr. "+str(groupcount))
Next
Regrads,
Philipp K.
AE | NI-Germany
10-22-2014 02:09 AM
If you have files and just want to load the first group you can just use selective loading instead.
Option Explicit Call DataFileLoadSel("example.TDM","TDM","[1]/*","Load")
This can also be used to load a group with a specific name or multiple groups of a single file.
Maybe this will spare you the delete.
10-22-2014 04:24 AM
Hello Philipp K.,
ich glaube, das funktioniert soweit. Ich werde es die Tage nochmals testen.
Danke
Gruß
portas
10-22-2014 06:16 AM
When deleting channels or Groups. It usually works best to delete from the highest number to the lower numbers. (Each time a group or channel is deleted, the group or channels numbers all change, and will make the numbers incorrect.)
Paul
10-22-2014 09:11 AM
Hi Paul,
you are absolutely right.
you should use a reverse counting loop for that.
Thank you very much.
Kind Regards,
Philipp K.
AE | NI-Germany