0

I'm using Lookuprows to retrieve data from a Data Extension.

When used in an email, it's not erroring, but it's not pulling in any data either.

The top part of the AMPscript looks like this:

%%[
SET@ID = ID
SET@ID = ID SET @rows = LookupRows("REF DE","Id", _subscriberkey)
SET @VN__c = ""
SET @VA__c = "" 
SET @RL__c =""

if rowcount(@rows) > 1 then

SET @row = row(@rows,1)
SET @VN__c = field(@row,"VN__c") 
SET @VA__c = field(@row,"VA__c") 
SET @RL__c = field(@row,"RL__c") endif ]%%

I'm then trying to pull data into the email like this:

%%=v(@VN__c)=%%
$%%=v(FormatNumber(@VA__c,"#,###"))=%%

What am I doing wrong?

  • Is the email in the child BU. If so you need ENT.DEname – EazyE Apr 4 at 19:26
  • They're both in the parent BU – Thomas Hockey Apr 4 at 19:29
3

Try this:

LookupRows("ENT.REF DE","Id", _subscriberkey)

The ENT. prefix is required for Shared and Synchronized Data Extensions:

When coding AMPScript using a Shared Data Extension in an Enterprise 2.0 account, you add the prefix "ENT." to the data extension.

Now there’s also a space in the DE name - here’s how to handle it:

In some situations, it is required to use brackets around the name of a Data Extension containing spaces. This is done when referencing the Data Extension directly as in the SQL code used with a Query Activity. 

However, as shown in the below example, using the Data Extension name as a parameter in a function call requires different syntax. Because of the quotes required around the function's parameters, the brackets are treated as part of the name of the Data Extension.The brackets are not needed inside the quotation marks and removing the brackets resolves the error.   

Examples:

Incorrect: Set @MyRows = LookupRows("ENT.[First Last]","Email","bjones@abc.com")

Correct: Set @MyRows = LookupRows("ENT.First Last","Email","bjones@abc.com")

Source: https://help.salesforce.com/articleView?id=000320283&language=en_US&mode=1&sfdcIFrameOrigin=null&type=1

| improve this answer | |
  • Further to the above, will this AMPscript only work if the Data Extension being referenced is the entry Data Extension for the Journey containing the email? Or does that restriction not apply? – Thomas Hockey Apr 9 at 17:27
  • 1
    Doesn’t matter for what purpose you use it - the ent. prefix is a way of referencing Shared and Synchronized Data Extensions – zuzannamj Apr 9 at 17:47

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.