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 Feb 27 '20 at 12:06
  • Yes, I tested this in an email and used the preview functionality. – Simon Feb 27 '20 at 12:07
  • OK, but did you preview against a subscriber? Do you have a Subscriber_Key column in your sendable Data Extension? – zuzannamj Feb 27 '20 at 12:09
  • Yes, written exactly the same way. – Simon Feb 27 '20 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 Feb 27 '20 at 12:12
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! – Simon Feb 27 '20 at 12:23
  • 1
    nice, didn't notice that :-) – zuzannamj Feb 27 '20 at 12:27
  • Thanks! You've cleared out almost all other possibilities :) – Rachid Mamai Feb 27 '20 at 12:38

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.