0

fairly easy question here I guess but I'm having problems with it.

So I was trying an AMPscript exercise in trailhead: Trailhead example script

Also, can be found here as exercise 3: https://trailhead.salesforce.com/content/learn/modules/ampscript-for-nondevelopers/practice-using-ampscript

Now in my own environment, I tried this with different variables:

%%[
    Var @Subscriber_Key
    Set @Subscriber_Key = Subscriber_Key
    Var @CardNumber
    Set @CardNumber = Lookup("CARDS_DE","Card_Number","Subscriber_Key",@Subscriber_Key) 
]%%
    %%=v(CardNumber)=%%

I didn't get an error but it didn't return any values. I used the same structure to make this script as in example. Is there something I'm missing here? The attributes should be right.

Attributes in CARDS_DE: Card_Number, Subscriber_Key, Date_Created

Subscriber_Key is also in the "Master DE".

6
  • How did you test this - in an email? Did you preview against a subscriber?
    – zuzannamj
    Commented Feb 27, 2020 at 12:06
  • Yes, I tested this in an email and used the preview functionality. Commented Feb 27, 2020 at 12:07
  • OK, but did you preview against a subscriber? Do you have a Subscriber_Key column in your sendable Data Extension?
    – zuzannamj
    Commented Feb 27, 2020 at 12:09
  • Yes, written exactly the same way. Commented Feb 27, 2020 at 12:10
  • And do you have a Subscriber_Key column in CARDS_DE? Can you update your original question with the structure of your sendable DE and the CARDS_DE?
    – zuzannamj
    Commented Feb 27, 2020 at 12:12

1 Answer 1

4

Found it. The problem is in your code, you've forgetten the @ character before CardNumber variable in the last line..

Try this:

%%[
    Var @Subscriber_Key
    Set @Subscriber_Key = Subscriber_Key
    Var @CardNumber
    Set @CardNumber = Lookup("CARDS_DE","Card_Number","Subscriber_Key",@Subscriber_Key) 
]%%
    %%=v(@CardNumber)=%%
3
  • It worked! Thanks! Commented Feb 27, 2020 at 12:23
  • 1
    nice, didn't notice that :-)
    – zuzannamj
    Commented Feb 27, 2020 at 12:27
  • Thanks! You've cleared out almost all other possibilities :) Commented Feb 27, 2020 at 12:38

You must log in to answer this question.

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