AMPscript
Add
Retrieve
Rows.Add
Rows.Lookup
Rows.Remove
Rows.Retrieve
Rows.Update
Validate Your Server-Side JavaScript using WSProxy
Retrieves up to 2500 rows of data in a data extension
Rows.Retrieve(1)
| Ordinal | Type | Description | |
|---|---|---|---|
| 1 | string | Specifies information to filter for the retrieve |
This sample code retrieves all data from the birthdayDE data extension.
1var birthdayDE = DataExtension.Init("birthdayDE");
2var data = birthdayDE.Rows.Retrieve();This sample code retrieves all data using a simple filter where the age is greater than 20.
1var birthdayDE = DataExtension.Init("birthdayDE");
2var filter = {Property:"Age",SimpleOperator:"greaterThan",Value:20};
3var data = birthdayDE.Rows.Retrieve(filter);This sample code retrieves all data using a complex filter where the age is greater than 20 and the first name is Angel.
1var birthdayDE = DataExtension.Init("birthdayDE");
2var complexfilter = {
3 LeftOperand:{
4 Property:"Age",
5 SimpleOperator:"greaterThan",
6 Value:20
7 },
8 LogicalOperator:"AND",
9 RightOperand:{
10 Property:"FirstName",
11 SimpleOperator:"equals",
12 Value:"Angel"
13 }};
14var moredata = birthdayDE.Rows.Retrieve(complexfilter);This function returns information in an array of objects in JSON format:
1[
2 {
3 "FirstName":"Angel",
4 "LastName":"Angel",
5 "EmailAddress":"aruiz@example.com",
6 "Age":"25",
7 "Birthday":"11/29/1985 12:00:00 AM"
8 }
9]The Retrieve function can’t be used in the context of an email message or email preview.