I have a AMPScript snippet where I am retrieving a variable from a returned row-set and then using the same variable as the value for a simple filter. The name of the variable is @listID.
If I don't use this variable, then the snippet works fine. I am unable to determine the issue. I have a hunch that it has something to do with variable scope and the for loop.
I would appreciate any inputs.
I have put the code snippet for reference as well.
%%[
IF @listCount > 0 THEN
for @i = 1 to @listCount do
Set @listname = Field(Row(@lists, @i),"ListName")
Set @ListID = Field(Row(@lists, @i),"ID")
set @rr1 = CreateObject("RetrieveRequest")
SetObjectProperty(@rr1,"ObjectType","ListSubscriber")
AddObjectArrayItem(@rr1,"Properties","ListID")
AddObjectAttayItem(@rr1,"Properties","Status")
set @sfp1 = CreateObject("SimpleFilterPart")
SetObjectProperty(@sfp1,"Property","SubscriberKey")
SetObjectProperty(@sfp1,"SimpleOperator","equals")
AddObjectArrayItem(@sfp1,"Value",@sid)
set @sfp2 = CreateObject("SimpleFilterPart")
SetObjectProperty(@sfp2,"Property","ListID")
SetObjectProperty(@sfp2,"SimpleOperator","equals")
AddObjectArrayItem(@sfp2,"Value",@listID)
set @cfp = CreateObject("ComplexFilterPart")
SetObjectProperty(@cfp,"LeftOperand", @sfp1)
SetObjectProperty(@cfp,"LogicalOperator", "AND")
SetObjectProperty(@cfp,"RightOperand", @sfp2)
SetObjectProperty(@rr1,"Filter",@cfp)
set @ListSubObj = InvokeRetrieve(@rr1,@rrStatus,@rrRequestID)
if rowCount(@ListSubObj) > 0 then
var @row
set @row = row(@ListSubObj, 1)
set @liststatus = field(@row,'Status')
if @liststatus != "Active" then
@checked = false
else
@checked = true*/
endif
endif
]%%
Thanks - Monomit
@checked
variable identifiers are missing their precedingset
keywords, (2) the closingnext @i
is missing from thefor
statement, (3) the closingendif
for the outermostif
statement is missing, and (4) there's an orphaned*/
comment delimiter. Other than that, could provide a little more details surrounding the issue? Are you seeing... an error message? Unexpected/incorrect values being assigned? Code blocks not being executed? – Mark G May 31 '19 at 4:21@sid
coming from? and is it actually the SubscriberID or is it the SubscriberKey (as it is assigned in the API call)? They are not synonymous and are completely different values. – Gortonington May 31 '19 at 11:57