I have a table that returns MID based on a concat of id and csid that are in my list. This works as it should.

Can I use the mid to do a lookup on another data extension to return an address? If so, how do i do it?

Table 1

idcsid mid
142 1001
242 1002
345 1003
485 1004
5245 1005
1245 1006



Var @id, @csid, @aidcsid, @idcsid,@mid, @row, @rows,@rowcount

Set @id = AttributeValue("id") 
Set @csid = AttributeValue("csid") 
Set @aidcsid = Concat(@id,@csid) 
Set @rows = LookupRows("mid", "idcsid", @aidcsid) 
set @rowCount = rowcount(@rows) 

if @rowCount > 0 then set @row = row(@rows,1) 

set @decid = field(@row,"mid") 


That works as it should.

I want to have another Data Extension that I can lookup based on mid. Is this possible?

mid = the derived value based on the previous lookup
csid = attribute value
lang = attribute value
addy = The field I need to return,

So the lookup will be on a concat of mid, csid, lang and then it returns addy.

Table 2

mid csid lang address
1001 42 en address in english
1001 42 pt address in portuguese
1001 42 it address in italian
1001 94 en address in english
1001 94 pt address in portuguese
1001 94 it address in italian

1 Answer 1


You should be able to just do a lookup or lookuprows using the 3 values as the conditions. I used a simple 'lookup' instead of a lookuprows as you only needed a single value and it looks like its a 1:1 match, so should not need to have consideration of multiple row returns. I also changed your current lookuprows to lookup.


Set @lang = AttributeValue("lang")
Set @id = AttributeValue("id") 
Set @csid = AttributeValue("csid") 
Set @aidcsid = Concat(@id,@csid) 
Set @decid = Lookup("Table1", "mid", "idcsid", @aidcsid) 

  set @address = Lookup("Table2","address","mid",@decid,"csid",@csid,"lang",@lang)


I added in the setting of @lang and used Table1 and Table2 as the DE names. Other than adjusting those to the correct context, the above should work for your needs.

  • 1
    will give it a try. It's lookup rows because I do have other fields that I return from the first table, but didn't add it to the example.
    – lyslexic
    Jul 8, 2022 at 14:05
  • For sure - can shift to lookuprows or lookuporderedrows as needed. Jul 8, 2022 at 15:49
  • busy adjusting. will ask again if I run into issues. Do I need a loop for this or will it find the row and retrieve the values without it? Table 1 and Table 2 DE are around 5K rows and sending to about 30K of recipients
    – lyslexic
    Jul 11, 2022 at 8:53

You must log in to answer this question.

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