PML for Wallthickness

Dear All, I would like to get from ALL BRANCH of PIPE the element with the highest ABORE with exception of elements like ATTA. I need to return the PWALL(1) of this element.

Here is what I have

var !PwalltElements COLLECT ALL BRAN FOR CE

if ( !PwalltElements.size().eq(0) ) then
return ''
endif

var !MemString MEMBER of $!PwalltElements[1]

if (!MemString.eq('unset')) then
return ''
else

!Members = !MemString.split()
var !PwalltAbore EVAL ABORE FOR ALL FROM !Members

!MatXtext = ''
!maxVal = 0
!maxIdx = 0
do !idx from 1 to !PwalltAbore.size()
!currVal = !PwalltAbore[!idx].real()
if (!currVal.gt(!maxVal)) then
!maxVal = !currVal
!maxIdx = !idx
endif
enddo

if (!maxIdx.neq(0)) then
VAR !Pwallt STRING(PWALLT(1) OF LSTUBE OF $!Members[$!maxIdx] )
endif

Return !Pwallt