Name Panel

Hi,

I am creating macro to name panel member of suppo but naming is having criteria.

Panel naming should start with Suppo name & then -P1 but if Panel psize & SPREF match for second panel then is should name 

suppo name & then -P1.1 if not then it should take next number like -P2 foe unique plate.

I am trying but I am not getting how I can collect panel once if condition satisfy.

Thanks...

!a = array()
!b = array()
!c = array()
!d = array()
!result = array()
var !sup name of suppo
var !col collect all pane for suppo
do !i values !col
$!i
!a.append(!!ce.refno.psize[1].nint())
!b.append(!!ce.refno.psize[2].nint())
!c.append(!!ce.refno.spref)
!x = !a.SortUnique()
!y = !b.SortUnique()
!z = !c.SortUnique()
if ('$!x' eq '$!a' and '$!y' eq '$!b' and '$!z' eq '$!c') then
 !d.Append(!!ce)
 --name /$!sup-P'$!x'
endif
enddo
!h = !d.SortUnique()
q var !h