Row()

Returns a row from a rowset, array, or object.

Availability

<table> <tr> <td>Marketing Cloud Engagement</td> <td>✅ Yes</td> </tr> <tr> <td>Marketing Cloud Next</td> <td>✅ Yes</td> </tr> </table>

This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0).

Syntax

Row(rowset, rowPosition)

The Row() function has two parameters:

  • rowset (string): Required. The rowset, array, or object to return a row from.
  • rowPosition (string): Required. The row number to return. The first row is row 1.

Usage

To use the function, pass it a rowset, and the row number that you want to return. This example sets the value of @row to the first row of the rowset contained in the @rowset variable.

%%[
  Set @row = Row(@rowset, 1)
]%%

You can combine the Row() function with the Field() function to output a specific piece of data from the specified row. This example creates a rowset from JSON data. The Row() function retrieves the first row from the rowset. The Field() function retrieves the value of the "Price" attribute from the first row.

%%[
  Set @json = '
  {
    "Flights": [
      {
        "Origin": "IND",
        "Dest": "NYC",
        "Price": 100.0,
        "PerBagSurcharge": "N/A"
      },
      {
        "Origin": "IND",
        "Dest": "LAX",
        "Price": 200.0,
        "PerBagSurcharge": "Free"
      },
      {
        "Origin": "IND",
        "Dest": "SEA",
        "Price": 500.0,
        "PerBagSurcharge": 25
      }
    ]
  }'
  Set @rowset = BuildRowsetFromJSON(@json, "$.['Flights'][*]", true)
  Set @row = Row(@rowset, 1)
  Set @field = Field(@row, "Price", 0)
  Output(v(@field))
]%%

The function outputs 100.