I'm aiming to have Ampscript on a Cloudpage decrement a value in a specific data extension field whenever the page loads. Eventually there will be further logic to determine which of two values to change, but as a proof-of-concept/test I'm just trying to reduce both. Currently my test page is throwing an internal server error and fails to load. The full code is below:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<p>
placeholder
</p>
</body>
%%[
Var @ontrade, @email, @otdec, @emdec, @update1, @update2
Set @ontrade = Lookup('GB_Test_Kit_Count', 'Count', 'Type', 'ontrade')
Set @email = Lookup('GB_Test_Kit_Count', 'Count', 'Type', 'email')
Set @otdec = Add(@ontrade,-1)
Set @emdec = Add(@email,-1)
Set @update1 = UpdateData(
'GB_Test_Kit_Count',
1,
'Type',
'ontrade',
'Count',
@otdec
)
Set @update2 = UpdateData(
'GB_Test_Kit_Count',
1,
'Type',
'email',
'Count',
@emdec
)
]%%
</html>
The data extension is named GB_Test_Kit_Count. It has two columns, 'Type' and 'Count' and two records {ontrade, 50} and {email, 100}.
I'm guessing I've just screwed up the syntax somewhere, but I can't spot the problem.