• Hello,

    I have multiple existing support atta in pipe like , BQ001,BQ003,BQ004,BQ005  where ( BQ002 is missing)



    and now i have created new support atta ( defeult name atta 5 ) and want to rename this atta with BQ002.

    It means if atta name sequence is missing than create the name with missing sequence, else last existing sequence + 1

    Please provide a macro

    Thank you
  • Hello,

    Did you get across a solution to this problem ?
    I am facing something similar and I am interested to know if there is some method to do this.

    Thanks.
  • $(
    ** Atta Naming based on pipe name
    $)
    !CE = !!CE
    --Var !coll cOLL all ATTA FOR CE
    var !coll coll all atta with Rtext of Detref of Spref neq 'Comment -  -  -' for ce
    DO !a indices !Coll
    $!Coll[$!a]
    UNNAME
    Handle (41,25)
    ENDHANDLE
    ENDDO
    DO !B indices !coll
    $!coll[$!B]
    bran
    handle (2,111)
    !!alert.error('Not at a component or branch')
    return
    endhandle
    !pipe = !coll[!B].dbref().owner.owner.name
    if (!pipe.substring(1,1) neq '/') then
    !!alert.error('PIPE not named!!')
    return
    endif
       !seq = 0
     do !i
       !seq = !seq + 1
       !anam = 'MQ' & '0' & !seq
       if (!seq le 9) then
         !anam = 'MQ' & '0' & !seq
       elseif (!seq ge 10) then
         !anam = 'MQ' & !seq.string()
       endif
       !name = !pipe & !anam
       $!name
       handle any
         break
       endhandle
     enddo
     $!coll[$!B]
     $* Assign name to ATTA
     Name $!name
       !empty = !coll[!b].DBref().Catref.Gmref.Members.Empty()
     Handle Any
      !emptyU = !coll[!b].DBref().Catref.Gmref
      If(!emptyU.Unset())then
        UNNAME
      Endif
     Elsehandle none
      If(!empty EQ TRUE)then
        UNNAME
      Endif    
     EndHandle


    Enddo


    !!ce = !ce
  • Idea is :
    1. Collect all atta with current name as Array()
    2. use do loop to trace atta with default name and rename it with missing sequence on above array
  • Perhaps you can try a logic like below.

    do !a from 1 to 999
       !suppname = '/BQ' & Substring(String( !a / 1000, 'D3' ),3,3)
       !test = !suppname.dbref()
       handle (2,109) $*  Undefined name /BQ001
           !!CE.Name = !suppname
           break
       elsehandle none
       endhandle
    enddo


    This is fairly simple sledgehammer route where each name is tested for existence. Better methods of doing this might be existing!