Need to remove duplicate slab on laye if they have the same pipe of DDNAME

On laye,  have many slabs which have the same attribute pipe of DDName. I need a small macro to remove duplicates the slab if they have same attribute pipe of DDName instead of deleting manually one by one. Hope you can help me.

Parents
  • You can use this macros standing on LAYE

    !aSlabs = !!CollectAllFor('SLAB', '', ce)
    !aUniqueDdnames = ARRAY()
    
    do !slab values !aSlabs
    	if(!aUniqueDdnames.FindFirst(!slab.Ddname).Unset().Not()) then
    		$p [dublicat found] = $!slab
    		$!slab
    		delete slab
    		handle none
    			$p [dublicat deleted]
    		elsehandle any
    			$p [dublicat can not be deleted]
    		endhandle	
    	else
    		!aUniqueDdnames.Append(!slab.Ddname)
    	endif
    enddo

Reply
  • You can use this macros standing on LAYE

    !aSlabs = !!CollectAllFor('SLAB', '', ce)
    !aUniqueDdnames = ARRAY()
    
    do !slab values !aSlabs
    	if(!aUniqueDdnames.FindFirst(!slab.Ddname).Unset().Not()) then
    		$p [dublicat found] = $!slab
    		$!slab
    		delete slab
    		handle none
    			$p [dublicat deleted]
    		elsehandle any
    			$p [dublicat can not be deleted]
    		endhandle	
    	else
    		!aUniqueDdnames.Append(!slab.Ddname)
    	endif
    enddo

Children