También puedes hacerlo directamente con un SQL
LIST (EXPRESION A CONCATENAR)
LIST (EXPRESION A CONCATENAR, SEPARADOR)
LIST devuelve un campo BLOB TIPO TEXTO
Código:
Suponiendo TABA es
ID CAMPO_A CAMPO_B
1 1 A
2 1 B
3 1 C
4 1 D
5 1 E
Código SQL
[-]
select list(CAMPO_A, '')
from TABLA
where
ID < 3
Resultado: BLOB="111"
Código SQL
[-]
select list(CAMPO_A ||'-'||CAMPO_B, ', ')
from TABLA
where
ID < 3
Resultado: BLOB="1-A, 1-B, 1-C"
Código SQL
[-]
select cast(
substring(
list(campo_a || '-' || campo_b, ', ')
from 1 for 7
)
as varchar(7)
)
from tabla
where
id < 3
Resultado: VARCHAR(7)="1-A, 1-"