### LookupRows() Function
Source: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-lookup-rows
Retrieves an unordered rowset from a specified data extension based on search criteria. This function is case-insensitive and can return up to 2,000 rows.
```APIDOC
## LookupRows()
### Description
Returns an unordered rowset from a data extension. The function can return a rowset with up to 2,000 rows. This function is case-insensitive.
### Method
AMPscript Function
### Parameters
#### Function Parameters
- **dataExt** (string) - Required - The name of the data extension that contains the data that you want to retrieve.
- **searchColumn1** (string) - Required - The name of the column to search. This value is case-insensitive.
- **searchValue1** (string) - Required - The value in the specified column that identifies the rows to retrieve. This value is case-insensitive.
*Additional search columns and values can be appended to the end of the parameter string.*
### Request Example
```ampscript
%%[
VAR @rows, @row, @email, @city
SET @rows = LookupRows("Customer", "City", "London")
IF NOT EMPTY(@rows) THEN
FOR @i = 1 TO RowCount(@rows)
SET @row = Row(@rows, @i)
SET @email = Field(@row, "EmailAddress")
SET @city = Field(@row, "City")
Output(Concat(@email, " - ", @city, "
"))
NEXT @i
ENDIF
]%%
```
### Response
#### Success Response
Returns a rowset containing matching records from the data extension. The output depends on how the retrieved data is processed within AMPscript.
```
--------------------------------
### LookupRows() Variations
Source: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-lookup-rows
Details on case-sensitive and ordered variations of the LookupRows() function.
```APIDOC
## LookupRows() Variations
### Description
AMPscript includes several variations of the `LookupRows()` function to provide more specific data retrieval capabilities.
### Variations
- **LookupRowsCS()**: A case-sensitive version of the `LookupRows()` function.
- **LookupOrderedRows()**: Allows you to specify a column and direction to sort the rowset by.
- **LookupOrderedRowsCS()**: A case-sensitive version of `LookupOrderedRows()`.
```
--------------------------------
### ClaimRowValue() Function
Source: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-claim-row-value
Searches a data extension for an unclaimed row, returns a specified value from that row, and updates the row to mark it as claimed. It supports a fallback value if no unclaimed rows are found and can populate additional columns.
```APIDOC
## ClaimRowValue()
### Description
Searches a data extension for an unclaimed row and returns a value from that row. The row that contains the value that was returned is updated in the data extension to indicate that the row has been claimed. Subsequent operations return the next unclaimed row in the data extension. This function is commonly used for managing coupon codes and redemption.
This function is similar to the ClaimRow() function. However, this function can return a fallback value if the data extension doesn’t contain any unclaimed rows. Additionally, this function returns a value from the unclaimed row, while the `ClaimRow()` function returns an entire row.
### Method
AMPscript Function
### Parameters
#### Function Parameters
- **dataExt** (string): Required. The data extension that contains the value to return. You must hard-code this value. If you specify an AMPscript variable for this parameter, the function returns an exception.
- **returnValueColumn** (string): Required. The name of the column that contains the data that you want the function to return.
- **claimColumn** (string): Required. The column that the function uses to track whether a row is claimed. This column must be configured in a specific way in the data extension.
- **valueIfClaimed** (string): Required. A fallback value that the function returns if there aren’t any unclaimed rows in the data extension.
- **claimantColumn** (string): Required. The column that the function uses to track the subscriber who claimed the row.
- **claimantValue** (string): Required. The value to enter in the `claimantColumn` column when the function claims a row.
*Additional parameters can be appended to populate more than one column in the claimed row.*
### Data Extension Configuration Requirements
- A required (non-nullable) boolean attribute with a default value of `False` (e.g., `IsClaimed`).
- A column for tracking the entity that claimed a row (e.g., `ClaimantID`).
- Optionally, a nullable Date column named `ClaimedDate` to automatically insert a timestamp.
### Request Example
```ampscript
%%[
VAR @couponCode
SET @couponCode = ClaimRowValue("CouponCodes", "CouponCode", "IsClaimed", "N/A", "EmailAddress", "sunhi.kim@example.com")
]%%
Your coupon code is: %%=v(@couponCode)=%%
```
### Response
#### Success Response
Returns a string value from the specified `returnValueColumn` of the first unclaimed row. The row is updated to mark it as claimed.
#### Fallback Response
Returns the `valueIfClaimed` string if no unclaimed rows are found in the data extension.
#### Response Example (Success)
```
S5MY7 উঠছে
```
#### Response Example (Fallback)
```
N/A
```
### Related Functions
- ClaimRow()
```
--------------------------------
### InsertData() Function
Source: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-insert-data
The InsertData() function inserts rows into a specified data extension. It requires the data extension name, column names, and the values to be inserted. This function is suitable for use in CloudPages, landing pages, microsites, and SMS messages.
```APIDOC
## InsertData() Function
### Description
Inserts rows into a data extension and returns the number of rows inserted. This function can be used in CloudPages, landing pages, microsites, and SMS messages.
### Method
AMPScript Function
### Endpoint
N/A (Script function within Marketing Cloud)
### Parameters
#### Function Parameters
- **dataExt** (string) - Required - The name of the data extension to insert data into.
- **columnName1** (string) - Required - The name of the first column to insert data into.
- **valueToInsert1** (string) - Required - The value to insert into the specified column.
*Additional column names and values can be appended to insert multiple values into a single row.*
### Request Example
```ampscript
SET @rowCount = InsertData("Flights", "FlightId", "4", "Origin", "IND", "Dest", "ORD", "Price", "125")
```
### Response
#### Success Response
Returns the number of rows inserted (integer).
#### Response Example
```
1
```
### Related Functions
- `InsertDE()`
```
--------------------------------
### ExecuteFilter() Function
Source: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-execute-filter
The ExecuteFilter() function executes a data filter based on a data extension and returns an unordered rowset of the results. It is designed for use in CloudPages, landing pages, microsites, and SMS messages.
```APIDOC
## ExecuteFilter()
### Description
Executes a data filter and returns an unordered rowset that contains the results. This function only works with data filters that are based on data extensions and can be used in CloudPages, landing pages, microsites, and SMS messages.
### Method
AMPScript Function
### Endpoint
N/A (Client-side AMPScript function)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Parameters
* **dataFilterExternalId** (string): Required. The external ID of the data filter to execute. This must be a data filter based on a data extension.
### Request Example
```ampscript
%%[
VAR @results, @filterId
SET @filterId = "c5a7e0d9-41e0-4068-bdcc-8766d7c1af94" /* External ID of the data filter */
SET @results = ExecuteFilter(@filterId)
IF RowCount(@results) > 0 THEN
FOR @i = 1 TO RowCount(@results)
SET @row = Row(@results, @i)
/* Access data from the rowset */
SET @memberId = Field(@row, "MemberId")
SET @firstName = Field(@row, "FirstName")
SET @surname = Field(@row, "Surname")
SET @rewardsPoints = Field(@row, "RewardsPoints")
SET @area = Field(@row, "Area")
OUTPUT(Concat("Member ID: ", @memberId, ", Name: ", @firstName, " ", @surname, ", Points: ", @rewardsPoints, ", Area: ", @area, "
"))
NEXT @i
ELSE
OUTPUT("No results found.")
ENDIF
]%%
```
### Response
#### Success Response (Rowset)
Returns an unordered rowset containing the data that matches the specified data filter. The structure of the rowset depends on the fields in the data extension associated with the data filter.
#### Response Example
(Output from the example above would be:
Member ID: 1, Name: Dennis Smithers, Points: 92374, Area: Chelsea
Member ID: 2, Name: Pooja Chatterjee, Points: 201042, Area: Hammersmith
Member ID: 3, Name: Tomás Santos, Points: 69311, Area: Kensington
)
### Error Handling
- If the `dataFilterExternalId` is invalid or does not exist, the function may return an empty rowset or an error.
- The function will not work with data filters based on profile attributes.
```
--------------------------------
### Cookie Consent Manager
Source: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-delete-data
Information regarding the types of cookies used on the website and their management.
```APIDOC
## Cookie Consent Manager
### General Information
We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
[Privacy Statement](link_to_privacy_statement)
### Required Cookies
**Status:** Always Active
**Description:** Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
[Cookies Details](link_to_required_cookies_details)
### Functional Cookies
**Status:** User selectable
**Description:** Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
[Cookies Details](link_to_functional_cookies_details)
### Advertising Cookies
**Status:** User selectable
**Description:** Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.
[Cookies Details](link_to_advertising_cookies_details)
### Cookie Management Controls
**Cookie List**
- [ ] Consent
- [ ] Leg.Interest
- [ ] checkbox label
- [ ] label
**Clear** [checkbox label label]
**Apply** **Cancel**
**Save Settings**
**Accept All Cookies**
```
--------------------------------
### DeleteDE() Function
Source: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-delete-de
Deletes rows from a data extension based on specified criteria. This function is primarily used within emails.
```APIDOC
## DeleteDE()
### Description
Deletes rows from a data extension. This function doesn’t return any output. Use this function to delete rows from a data extension in an email. Use the DeleteData() function to delete rows in CloudPages, landing pages, microsites, and SMS messages in MobileConnect.
### Method
AMPSCRIPT
### Endpoint
N/A (This is a server-side scripting function)
### Parameters
#### Function Parameters
- **dataExt** (string): Required. The name of the data extension that contains the data you want to delete.
- **columnName1** (string): Required. The name of the column to search for the data you want to delete.
- **valueToDelete1** (string): Required. The value that the function uses to determine which row to delete.
*Note: Multiple rows can be deleted by appending additional `columnName` and `valueToDelete` pairs.*
### Usage Example
To delete the row in which the value in the `Dest` column is "LAX" from the `Flights` data extension:
```ampscript
DeleteDE("Flights", "Dest", "LAX")
```
To delete rows where either the `Origin` or `Dest` column is "ATL" from the `Flights` data extension:
```ampscript
DeleteDE("Flights", "Origin", "ATL", "Dest", "ATL")
```
### Response
This function does not return any output.
```
--------------------------------
### Delete Rows from Data Extension using DeleteDE() in AMPscript
Source: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-delete-data
This AMPscript code snippet demonstrates the usage of the DeleteDE() function, which is specifically used to delete rows from a data extension within an email context. It's an alternative to DeleteData() for email-specific operations.
```ampscript
%%[
/* Example for DeleteDE() - specific usage details would depend on context */
/* DeleteDE('DataExtensionName', 'ColumnNameToFilter', 'ValueToFilter') */
]%%
```
--------------------------------
### Delete Multiple Rows from Data Extension using DeleteDE() in AMPScript
Source: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-delete-de
This AMPScript code snippet shows how to delete multiple rows from a data extension using the DeleteDE() function. It removes rows from the 'Flights' data extension where either the 'Origin' or 'Dest' column is 'ATL'.
```ampscript
%%[
/* Deletes rows where Origin = 'ATL' OR Dest = 'ATL' from the Flights data extension */
DeleteDE('Flights', 'Origin', 'ATL', 'Dest', 'ATL')
]%%
```
--------------------------------
### Delete Single Row from Data Extension using DeleteData() in AMPscript
Source: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-delete-data
This AMPscript code snippet demonstrates how to delete a single row from a data extension based on a specific column value. It requires the data extension name, a column name, and the value to delete.
```ampscript
%%[
VAR @rowsDeleted
SET @rowsDeleted = DeleteData('Flights', 'Dest', 'LAX')
OUTPUT(RowCount(@rowsDeleted))
]%%
```
--------------------------------
### Delete Single Row from Data Extension using DeleteDE() in AMPScript
Source: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-delete-de
This AMPScript code snippet demonstrates how to delete a single row from a data extension based on a specific column value. It targets the 'Flights' data extension and removes the row where the 'Dest' column is 'LAX'.
```ampscript
%%[
/* Deletes the row where Dest = 'LAX' from the Flights data extension */
DeleteDE('Flights', 'Dest', 'LAX')
]%%
```
--------------------------------
### Delete Multiple Rows from Data Extension using DeleteData() in AMPscript
Source: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-delete-data
This AMPscript code snippet shows how to delete multiple rows from a data extension by specifying multiple criteria. It uses the DeleteData() function to remove rows where either the 'Origin' or 'Dest' column matches 'ATL'.
```ampscript
%%[
VAR @rowsDeleted
SET @rowsDeleted = DeleteData('Flights', 'Origin', 'ATL', 'Dest', 'ATL')
OUTPUT(RowCount(@rowsDeleted))
]%%
```
--------------------------------
### DeleteData() Function
Source: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-delete-data
Deletes rows from a data extension based on specified criteria and returns the count of deleted rows. This function can be used in landing pages, microsites, and SMS messages.
```APIDOC
## DeleteData()
### Description
Deletes rows from a data extension, and returns the number of rows deleted. This function can be used in landing pages, microsites, and SMS messages in Mobile Connect. Use the `DeleteDE()` function to delete rows from a data extension in an email.
### Method
Ampscript Function
### Endpoint
N/A (Ampscript function)
### Parameters
#### Function Parameters
- **dataExt** (string): Required. The name of the data extension that contains the data you want to delete.
- **columnName1** (string): Required. The name of the column to search for the data you want to delete.
- **valueToDelete1** (string): Required. The value that the function uses to determine which row to delete.
*Note: Multiple rows can be deleted by appending additional `columnName` and `valueToDelete` pairs.*
### Request Example
```ampscript
SET @rowsDeleted = DeleteData("Flights", "Dest", "LAX")
```
### Response
#### Success Response
- **Return Value** (Number) - The number of rows deleted from the data extension.
#### Response Example
```
1
```
### Related Functions
- DeleteDE()
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.