-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchapter3.amp
More file actions
40 lines (31 loc) · 1.51 KB
/
chapter3.amp
File metadata and controls
40 lines (31 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
%%[
/*
Steps:
1. Specify the Data Extension name, search attribute, and case-sensitive search value.
2. Use LookupRowsCS to retrieve rows that match the criteria.
3. Get the total number of matching rows.
4. Loop through each row to extract and optionally display column values.
*/
/* Declare variables */
var @rows, @dataExtensionName, @attributeToSearch, @valueToSearch, @rowCount, @index, @row
/* Set the name of the data extension to be used */
set @dataExtensionName = "My_DataExtension"
/* Set the attribute to search by in the data extension */
set @attributeToSearch = {{attributeToSearch}}
/* Set the value to search for in the given attribute */
set @valueToSearch = {{valueToSearch}}
/* Use the LookupRowsCS function to fetch all rows that match the search criteria */
set @rows = LookupRowsCS(@dataExtensionName, @attributeToSearch, @valueToSearch)
/* Get the total number of rows returned by the LookupRowsCS function */
set @rowCount = RowCount(@rows)
/* Check if any rows were returned */
if @rowCount > 0 then
/* Loop through each row and extract values for specified columns */
for @index = 1 to @rowCount do
set @row = Row(@rows, @index)
{{columnAssignments}}
/* Optionally: you can output these values for debugging or further use */
OutputLine(concat({{outputLineColumns}}))
next @index
endif
]%%