How to check unused IDLIST in drawing and delete them

 
  • Hello,
    I want to check unused IDLI and delete them, so I have written below code but it does not find out which one is not used .
    Can you please suggest me in this?

    !ce=!!ce
    var !IDLILIST collect all idli for ce
    var !VIEWREF collect all view for ce
    do !x indices !IDLILIST
    $!IDLILIST[$!x]
       var !idlnam name
       do !d indices !VIEWREF
       $!VIEWREF[$!d]
       var !ff Idlname
       if ( $!idlnam  neq  $!ff  ) then
       !unused = TRUE
       endif
       q var !used
       enddo
    enddo
    $!ce
  • Hello Parth,

    Could you try the following code ?


    !ce = !!ce
    !idlis = !!collectAllFor('IDLI', '', CE)
    !views = !!collectAllFor('VIEW', '', CE)
    Do !idli values !idlis[INDENT]!used = FALSE[/INDENT]
    [INDENT]Do !view values !views[/INDENT]
    [INDENT=2]If !view.idln EQ !idli Then[/INDENT]
    [INDENT=3]!used = TRUE[/INDENT]
    [INDENT=3]break[/INDENT]
    [INDENT=2]Endif[/INDENT]
    [INDENT]Enddo[/INDENT]
    [INDENT]If !used.not() Then[/INDENT]
    [INDENT=2]$!idli[/INDENT]
    [INDENT=2]DELETE IDLI[/INDENT]
    [INDENT]Endif[/INDENT]
    Enddo
    $!ce