AMPscript BuildRowSetFromString (Next)
Split a delimited string into a rowset with AMPscript BuildRowSetFromString in Marketing Cloud Next. Syntax, examples, and behaviour proven in a Marketing Cloud Next email, including the column that reads back as true instead of the segment.
Syntax
BuildRowSetFromString(sourceData, delimiter) → rowset
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
sourceData |
string | Yes | The delimited string to split into rows |
delimiter |
string | Yes | The separator to split on, one or more characters long |
Both arguments are needed: an email that passes only the source string cannot be saved.
Example
%%=RowCount(BuildRowSetFromString("North**South**East**West", "**"))=%%
Renders 4.
Use the row count to tell how many segments a string has; reading the segments back is not reliable in Next (see below).
Return value
rowset — one row per segment of the input string.
An empty string and an unset variable both give a rowset of zero rows.
Behaviour
The row count matches the segments. North**South**East**West split on ** gives 4. A trailing separator adds an empty last row: a,b, gives 3, and the third row reads empty. Input without the separator gives one row, and an empty separator splits nothing: a,b,c with "" gives 1.
Reading a segment returns true, not the text. Field(Row(@rows, 1), 1) on the North**South**East**West rowset gives true; row 4 gives true too, not West. Reading the Value column with Field(row, "Value", 0) gives false: Next returns the flag (the third argument of Field, true when omitted), not the cell.
Row 0 does not fail. Field(Row(@rows, 0), 1) gives true.
Field(row, 0) gave different results depending on how it was written. The nested form Field(Row(BuildRowSetFromString("a,b,c", ","), 1), 0) breaks the render (HTTP 500). With the row stored in a variable first (SET @row = Row(@rows, 1), then Field(@row, 0)), it rendered true (see Field).
Reading a row of a :: split failed to render. RowCount(BuildRowSetFromString("a::b::c", "::")) on its own gives 3. An email that rendered that count together with Field(Row(BuildRowSetFromString("a::b::c", "::"), 2), 1) made the preview fail (HTTP 500).
Either capitalisation works. BuildRowsetFromString with a lowercase s gives the same row count.
Show Next test script
<!-- Marketing Cloud Next test script for BuildRowSetFromString. Paste it into the HTML component of a
Next email and open the preview. Each line prints the result Next gave when the call
was rendered on its own (expect) next to the result of this run (got).
Assembled from single-call test emails (dates on the page); it has not been
run as one email. Calls that make Next fail are listed separately. -->
<p>c1 expect=[4] got=[%%=RowCount(BuildRowSetFromString("North**South**East**West","**"))=%%]</p>
<p>c2 expect=[true] got=[%%=Field(Row(BuildRowSetFromString("North**South**East**West","**"),1),1)=%%]</p>
<p>c3 expect=[3] got=[%%=RowCount(BuildRowSetFromString("a,b,",","))=%%]</p>
<p>c4 expect=[0] got=[%%=RowCount(BuildRowSetFromString("",","))=%%]</p>
<p>c5 expect=[true] got=[%%=Field(Row(BuildRowSetFromString("North**South**East**West","**"),4),1)=%%]</p>
<p>c6 expect=[false] got=[%%=Field(Row(BuildRowSetFromString("a,b,c",","),1),"Value",0)=%%]</p>
<p>c7 expect=[[]] got=[[%%=Field(Row(BuildRowSetFromString("a,b,",","),3),1)=%%]]</p>
<p>c8 expect=[1|true] got=[%%=RowCount(BuildRowSetFromString("NoDelimiterHere",","))=%%|%%=Field(Row(BuildRowSetFromString("NoDelimiterHere",","),1),1)=%%]</p>
<p>c9 expect=[0] got=[%%=RowCount(BuildRowSetFromString(@r2bsunset,","))=%%]</p>
<p>c10 expect=[1] got=[%%=RowCount(BuildRowSetFromString("a,b,c",""))=%%]</p>
<p>c11 expect=[3] got=[%%=RowCount(BuildRowsetFromString("a,b,c",","))=%%]</p>
<p>c12 expect=[true] got=[%%=Field(Row(BuildRowSetFromString("a,b,c",","),0),1)=%%]</p>
Show calls that fail in Next (one email each)
<!-- Run each call below in its own Next email: one of them in a combined email
would stop the whole preview or block the save. -->
<!-- email 1: expect that the email saves, but the preview fails (HTTP 500) -->
%%=RowCount(BuildRowSetFromString("a::b::c","::"))=%%|%%=Field(Row(BuildRowSetFromString("a::b::c","::"),2),1)=%%
<!-- email 2: expect that the email saves, but the preview fails (HTTP 500) -->
%%=Field(Row(BuildRowSetFromString("a,b,c",","),1),0)=%%
<!-- email 3: expect that the save is rejected (HTTP 400) -->
%%=RowCount(BuildRowSetFromString("a,b,c"))=%%
Differs from official docs
- Documented as unavailable in Next, yet accepted. The reference’s availability table says No for Marketing Cloud Next. In a Next email the function split strings with correct row counts (
4forNorth**South**East**Weston**). Card - Reading a segment by number gives
true. The reference reads the unnamed column withField(row, 1). In Next that returnedtrueinstead of the segment text; see Field returns the flag. Card
Availability & differences
| Platform | Available |
|---|---|
| Marketing Cloud Engagement | Yes |
| Marketing Cloud Next | Yes, from API 68.0 |
Row counts match (4 for North**South**East**West, 3 for a,b,, 0 for an empty string). Reading a segment does not: Engagement returns the text (Field(Row(@rows, 1), 1) gives North, the Value column gives a), while Next returns the flag of Field (its third argument, true when omitted) instead of the cell: true by position, false for Field(row, "Value", 0). Row(@rows, 0) aborts in Engagement but gives true in Next. Compared 2026-11-23 by rendering the same calls in a Marketing Cloud Next email.
See also
BuildRowsetFromJSON— builds a rowset from JSONBuildRowSetFromXML— builds a rowset from XMLRow,Field,RowCount— read the rowset- Official reference