tente fazer assim:
shared numberVar x; shared stringVar y; (if {?SUBGRUPO} = '*' then 'Todos os Subgrupos' else 'SubGrupos: ' + ToText( (for x := 1 to ubound( {?SUBGRUPO}) do IFx = ubound({?SUBGRUPO}) THEN y := y + ({?SUBGRUPO}[x]) ELSE y := y + ({?SUBGRUPO}[x]+ ", " ); y; ) ) )