DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

delete groups

Solved!
Go to solution

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

 

0 Kudos
Message 1 of 6
(6,764 Views)
Solution
Accepted by topic author portas

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

0 Kudos
Message 2 of 6
(6,753 Views)

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.

0 Kudos
Message 3 of 6
(6,748 Views)

Hello Philipp K.,

 

ich glaube, das funktioniert soweit. Ich werde es die Tage nochmals testen.

 

Danke

Gruß

portas

0 Kudos
Message 4 of 6
(6,740 Views)

 

 

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

 

Message 5 of 6
(6,731 Views)

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

 

0 Kudos
Message 6 of 6
(6,722 Views)