We send emails to our dealers, and for each brand a dealer sells we have a record in a 'Brands' synchronized data extension. So if one dealer sells multiple brands, there will be multiple records for his id in that data extension. I'm trying to come up with the simplest way to only show a piece of content/HTML to a dealer selling a certain brand.
Because I'm only getting started with Ampscript, first I put a simple lookup as content in the email. This is what I started with:
This returns a brand when I go through the various dealers in my email preview. But, only one. So I should probably be using LookupRows instead of Lookup if I want all of the values returned, is that correct?
Then, I hoped I could use the Lookup as condition in an IF statement. So I made an HTML block which is basically like this:
%%[IF Lookup("ent.Brands","Brand","DealerId", AccountId) = "Brandname" THEN]%% --HTML-- %%[ENDIF]%%
But the preview screen now returns the following error:
There is an error in your email. Please contact your customer service representative. Error 1: Script IF Statement Invalid The script condition contains an invalid comparison operator.
I've seen examples here where a variable is declared, filled using a lookup, and then used in a way like IF @variable = "value",
I also came across this page on ampscript.com, but I don't fully understand it and I think that's maybe more than what I'm looking for.
Basically, what I'm looking for is Ampscript that compares all returned rows with a certain value (brand name) and if one of the rows contains that value, show some HTML. Can anyone help find the easiest way to do this?
Thanks in advance!