1

I would like to build a variable which will be used to add parameters to a url. This new variable (mQ) is based on a lookup of 3 BOOLEAN status fields in the database. For each of these database fields, if the status is TRUE, I want to set a value of blank. If the status is FALSE, I want to set a value to a specific number (1 for completion status 1 field, 2 for status 2 field, 3 for status 3 field). What I've attempted will function but only for the first 2 records sent. At the 3rd record, it sets the variable to be "123" every time thereafter for some reason. What am I doing wrong or what would you do differently?

%%[ VAR @Status1, @Status2, @Status3, @id, @email, @mQ

Set @id = [Contact ID]
Set @email = email

set @Status1 = Lookup(@lookupDE, "Week 1 Complete","Contact ID",@id)

set @Status2 = Lookup(@lookupDE, "Week 2 Complete","Contact ID",@id)

set @Status3 = Lookup(@lookupDE, "Week 3 Complete","Contact ID",@id)

if @Status1 == "true" then
Set @StatusA = ''
else
Set @StatusA = 1
endif

if @Status2 == "true" then
Set @StatusB = ''
else
Set @StatusB = 2
endif

if @Status3 == "true" then
Set @StatusC = ''
else
Set @StatusC = 3
endif

Set @mQ=Concat(@StatusA, @StatusB, @StatusC)

if @mq == "" then
Set @mQ = 0
endif

Set @landingpage = Concat('http://www.foobar.com','?email=',@email,'&id=',@id,'&mQ=',@mQ)

]%%

THIS IS THE HREF that I'm using within the link:

href="%%=RedirectTo(@landingpage)=%%"
1

Donna! Did you figure this out yet?

I just took your code, and aside from me calling the DE in quotes for setting of statuses, this works for me when previewing (via Preview and Test) within the editor against a DE. Here's one of my set statements: (other than that, the code is identical to yours)

set @Status1 = Lookup("TestingStatusLookup", "Week 1 Complete","Contact ID",@id)

I've included a capture of my Lookup DE below, and your code returns 2,1,23, and 0, respectively.

My Lookup DE

Here's my code:

%%[ VAR @Status1, @Status2, @Status3, @id, @email, @mQ
Set @id = [Contact ID]
Set @email = emailaddress

set @Status1 = Lookup("TestingStatusLookup", "Week 1 Complete","Contact 
ID",@id)

set @Status2 = Lookup("TestingStatusLookup", "Week 2 Complete","Contact 
ID",@id)

set @Status3 = Lookup("TestingStatusLookup", "Week 3 Complete","Contact 
ID",@id)

if @Status1 == "true" then
Set @StatusA = ''
else
Set @StatusA = 1
endif

if @Status2 == "true" then
Set @StatusB = ''
else
Set @StatusB = 2
endif

if @Status3 == "true" then
Set @StatusC = ''
else
Set @StatusC = 3
endif

Set @mQ=Concat(@StatusA, @StatusB, @StatusC)

if @mq == "" then
Set @mQ = 0
endif

Set @landingpage = Concat('http://www.foobar.com','? 
email=',@email,'&id=',@id,'&mQ=',@mQ)

]%%

%%=v(@mq)=%%<br/>
%%=v(@landingpage)=%%

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.