I am trying to concat all the non empty field values from a row in my DE, into a single variable (each value in the concatenated string separated by a comma).
The field names are: FIELD1
, FIELD2
and FIELD3
. Hence I tried adding a counter @i
to the field name in a loop, but no luck.
For example, if only FIELD2
and FIELD3
had values( 'abc' and 'def') and FIELD1
was empty, my desired output would be: "abc,def"
set @Id = 'test.gmail.com'
set @rows = LookupRows("MyDE","Id", @Id)
set @rowCount = rowcount(@rows)
set @row = row(@rows,1)
set @strng = ""
/* here is the loop where I try to concat the non empty values */
FOR @i = 1 TO 3 DO
if not empty(field(@row,CONCAT("FIELD", @i))) then
set @strng = field(@row,CONCAT("FIELD", @i, ','))
else
endif
NEXT @i