1

​I'm stumped. I’ve thought long and hard as to how to get “marketable” data from “technical” data and this is what I’ve come up with:

%%[
VAR @prod1
IF IndexOf("%%=ContentAreaByName('My Contents\PID')=%%","1") > 0 THEN
    SET @prod1 = 'success'
ELSE
    SET @prod1 = 'fail'
ENDIF
]%%

I thought this would work and it does. However, after investigating this, I realized the IndexOf function was not referencing the information in the ContentAreaByName piece but rather the words *%%=ContentAreaByName('My Contents\PID')=%%*

E.g., if you would reference “PID” (instead of “1”) it would return the VAR success.

Does anyone know how I can get the IndexOf function to actually query the ContentAreaByName function before producing an output?

1 Answer 1

1

The %%==%% syntax is only allowed outside the AMPScript block -- %%[]%%.

I'd do it like this:

%%[

VAR @prod1, @ca
set @ca = ContentAreaByName('My Contents\PID')

IF IndexOf(@ca,"1") > 0 THEN
  SET @prod1 = 'success'
ELSE
  SET @prod1 = 'fail'
ENDIF

]%% 

<br>prod1: %%=v(@prod1)=%%
1
  • Thanks Adam! This worked. Thank you for taking the time to review my question, and reply with an answer that was understandable and correct. May 8, 2016 at 7:26

You must log in to answer this question.

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