0

I have 2 lookup tables.

Table1 - Houses the email content and the lookup is on daymarker and language combination.

Table2 - This is used to group multiple brands. (Brand1 can have multiple CID's, so I group them into a single MCID).

Is there a more efficient way to combine these 2 lookups? They share the same attribute values like language.

What I am finding is, when the 1st lookup doesn't find the language and defaults to "en", it then ignores the 2nd lookup.

<!==
%%[
Var @daymarker, @language, @firstname, @row, @rows, @ldaymarker, @llanguage, @daylang, @rowcount


Set @ldaymarker = AttributeValue("daymarker")
Set @llanguage = AttributeValue("language")
Set @firstname = AttributeValue("firtstname")
Set @rows = LookupRows("content", "daymarker",@ldaymarker,"language",@llanguage)
Set @rowCount = rowcount(@rows) if @rowCount > 0 then
Set @row = row(@rows,1)
Set @daymarker = field(@row,"daymarker")
Set @language = field(@row,"language")
Set @SubjectLine = field(@row,"SubjectLine")
Set @MainImage = field(@row,"MainImage")
Set @Button = field(@row,"Button")
set @MainText = field(@row,"MainText")
set @HeaderText = field(@row,"HeaderText")

else

Set @llanguage = "en"
Set @rows = LookupRows("content", "daymarker",@ldaymarker,"language",@llanguage)
Set @row = row(@rows,1)
Set @daymarker = field(@row,"daymarker")
Set @language = field(@row,"language")
Set @SubjectLine = field(@row,"SubjectLine")
Set @MainImage = field(@row,"MainImage")
Set @Button = field(@row,"Button")
set @MainText = field(@row,"MainText")
set @HeaderText = field(@row,"HeaderText")


endif

Var @ccid, @ggid, @row, @rows, @cid, @gid, @mcid, @rowcount, @lang, @logo, @forgotpassword, @contactus, @ios, @android

Set @cid = AttributeValue("cid")
Set @gid = AttributeValue("ggId")
Set @lang = AttributeValue("language")
Set @rows = LookupRows("mcidlookup", "ccid", @cid,"ggid",@gid,"language",@lang )
set @rowCount = rowcount(@rows) if @rowCount > 0 then
set @row = row(@rows,1)
set @decid = field(@row,"cid")
set @degsid = field(@row,"gid")
set @mcid = field(@row,"mcid")

set @brandname = field(@row,"brandname")
set @address = field(@row,"eaddress")
set @brandlogo = concat("http://abc.com/homepage", @mcid,"/")
set @forgotpassword = concat("http://abc.com/fp", @mcid,@lang,"/")
set @contactus = concat("http://abc.com/contact", @mcid,@lang,"/")
set @ios = concat("http://abc.com/", @mcid,"dmappios/")
set @android = concat("http://abc.com/", @mcid,"dmappandroid/")
endif


]%%
==>

2 Answers 2

2

Not sure why you’re using two different variables for language - fist you have @llanguage and then @lang when in fact this seems to be the same value. This could be the reason it fails in the second part of the script, because you don’t have a default value like the “en” in the first part of the script.

Try this instead, it should keep the whole logic consistent:

%%[
Var @daymarker, @language, @firstname, @row, @rows, @ldaymarker, @llanguage, @daylang, @rowcount


Set @ldaymarker = AttributeValue("daymarker")
Set @llanguage = AttributeValue("language")
Set @firstname = AttributeValue("firtstname")
Set @rows = LookupRows("content", "daymarker",@ldaymarker,"language",@llanguage)
Set @rowCount = rowcount(@rows) 
if @rowCount > 0 then
Set @row = row(@rows,1)
Set @daymarker = field(@row,"daymarker")
Set @language = field(@row,"language")
Set @SubjectLine = field(@row,"SubjectLine")
Set @MainImage = field(@row,"MainImage")
Set @Button = field(@row,"Button")
set @MainText = field(@row,"MainText")
set @HeaderText = field(@row,"HeaderText")

else

Set @llanguage = "en"
Set @rows = LookupRows("content", "daymarker",@ldaymarker,"language",@llanguage)
Set @row = row(@rows,1)
Set @daymarker = field(@row,"daymarker")
Set @language = field(@row,"language")
Set @SubjectLine = field(@row,"SubjectLine")
Set @MainImage = field(@row,"MainImage")
Set @Button = field(@row,"Button")
set @MainText = field(@row,"MainText")
set @HeaderText = field(@row,"HeaderText")


endif

Var @ccid, @ggid, @row, @rows, @cid, @gid, @mcid, @rowcount, @lang, @logo, @forgotpassword, @contactus, @ios, @android

Set @cid = AttributeValue("cid")
Set @gid = AttributeValue("ggId")
Set @rows = LookupRows("mcidlookup", "ccid", @cid,"ggid",@gid,"language",@llanguage)
set @rowCount = rowcount(@rows) 
if @rowCount > 0 then
set @row = row(@rows,1)
set @decid = field(@row,"cid")
set @degsid = field(@row,"gid")
set @mcid = field(@row,"mcid")

set @brandname = field(@row,"brandname")
set @address = field(@row,"eaddress")
set @brandlogo = concat("http://abc.com/homepage", @mcid,"/")
set @forgotpassword = concat("http://abc.com/fp", @mcid,@lang,"/")
set @contactus = concat("http://abc.com/contact", @mcid,@lang,"/")
set @ios = concat("http://abc.com/", @mcid,"dmappios/")
set @android = concat("http://abc.com/", @mcid,"dmappandroid/")
endif


]%%
2

Zuzanna is correct. I had the code ready but found that she had already answered your question ^^. So, if you'd like to spare some lines of code, here is a lighter version:

%%[
Var @daymarker, @language, @firstname, @row, @rows, @ldaymarker, @llanguage, @daylang, @rowcount, 
@ccid, @ggid, @row, @rows, @cid, @gid, @mcid, @rowcount, @lang, @logo, @forgotpassword, @contactus, @ios, @android

Set @ldaymarker = AttributeValue("daymarker")
Set @llanguage = AttributeValue("language")
Set @firstname = AttributeValue("firtstname")
Set @cid = AttributeValue("cid")
Set @gid = AttributeValue("ggId")

Set @rows = LookupRows("content", "daymarker",@ldaymarker,"language",@llanguage)
if rowcount(@rows) == 0 then  
  Set @llanguage = "en" 
  Set @rows = LookupRows("content", "daymarker",@ldaymarker,"language",@llanguage)
endif

if rowcount(@rows) > 0 then  
  Set @row = row(@rows,1)
  Set @daymarker = field(@row,"daymarker")
  Set @language = field(@row,"language")
  Set @SubjectLine = field(@row,"SubjectLine")
  Set @MainImage = field(@row,"MainImage")
  Set @Button = field(@row,"Button")
  set @MainText = field(@row,"MainText")
  set @HeaderText = field(@row,"HeaderText")
endif

Set @rows = LookupRows("mcidlookup", "ccid", @cid,"ggid",@gid,"language",@llanguage)
if rowcount(@rows) > 0 then
  set @row = row(@rows,1)
  set @decid = field(@row,"cid")
  set @degsid = field(@row,"gid")
  set @mcid = field(@row,"mcid")
  
  set @brandname = field(@row,"brandname")
  set @address = field(@row,"eaddress")
  set @brandlogo = concat("http://abc.com/homepage", @mcid,"/")
  set @forgotpassword = concat("http://abc.com/fp", @mcid,@lang,"/")
  set @contactus = concat("http://abc.com/contact", @mcid,@lang,"/")
  set @ios = concat("http://abc.com/", @mcid,"dmappios/")
  set @android = concat("http://abc.com/", @mcid,"dmappandroid/")
endif
]%%

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .