0

I have a field in data extension which has a data with comma separated like 6QB902085, 7T2390GHG, I want to display the comma separated in new line. I found it in stack i tried to use AMP Script with below code on which theTestOutput is blank and i am getting rowcount as 1.

%%[
    Var @testString, @testOutput

    Set @testString = "6QB922085, 7T2311GHG"
    Set @testOutput = BuildRowsetFromString(@testString,",")

]%%

RowCount: %%=RowCount(@testOutput)=%%
TestOutput: %%=v(@testOutput)=%%
2
  • do you mean just the variable 'testOutput' is blank, or that the RowCount is also blank? Sep 25, 2017 at 19:14
  • TestOutput is blank. I am getting rowcount as 1 Sep 25, 2017 at 19:17

1 Answer 1

1

You are trying to get a rowset displayed as a string, when a rowset is more akin to a JSON. This is similar to using LookupRows(), etc. You will need to parse the data in order to display it.

See below code, which should provide you the two values.

%%[
    Var @testString, @stringRowset

    Set @testString = "6QB922085, 7T2311GHG"
    Set @stringRowset = BuildRowsetFromString(@testString,",")
]%%
RowCount: %%=RowCount(@stringRowset)=%%
<br /><br />
%%[
for @i = 1 to Rowcount(@stringRowset) do
Set @row = Row(@stringRowset, @i)
Set @value = Field(@row,1)
]%%
TestOutput: %%=v(@value)=%%<br />
%%[
next @i
]%%

OUTPUT:

RowCount: 2

TestOutput: 6QB902085
TestOutput: 7T2390GHG

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .