-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchapter11.amp
More file actions
28 lines (23 loc) · 1.27 KB
/
chapter11.amp
File metadata and controls
28 lines (23 loc) · 1.27 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
%%[
/* Set the name of the data extension to be used */
set @dataExtensionName = "My_DataExtension"
/* Initialize variables for search criteria and columns to be updated */
set @search1Column = "{{column1}}" /* The column used for searching rows to update */
set @search1Value = "SomeSearchValue" /* The value to search for in @search1Column */
set @noOfColumnsToSearch = 1 /* Number of columns to search in the data extension */
/* Initialize variables to with updated values */
{{#columns}}
set @{{Updatecolumn}} = "{{UpdateValue}}"
{{/columns}}
/* Use UpsertDE to insert or update the row in the specified data extension */
/* The function will update rows where @search1Column matches @search1Value,
or insert a new row if no match is found */
set @isUpdated = UpsertDE(@dataExtensionName,
@noOfColumnsToSearch,
@search1Column, @search1Value,
{{#columns_comma}}"{{column}}", @{{column}}{{/columns_comma}}
)
/* Output the result of the UpsertData function */
/* The function returns 1 for success (insert or update) and 0 for failure */
Output(v(@isUpdated))
]%%