salesforce-marketing-cloudampscript

Ampscript in marketing cloud - If value LIKE


Similar to SQL, I was wondering if your able to add ampscript that say if a value is like a wildcard. For example, %%[IF Value LIKE "%1234" THEN]%%


Solution

  • You can use the indexOf function:

    %%[ if indexof(AttributeValue("value"),"1234") > 0 then ]%%
    

    If it needs to be more specific you can use a combination of the length and subString functions.