Assign a value of a variable, back to the variable | Community
Skip to main content
Level 2
August 13, 2024
Solved

Assign a value of a variable, back to the variable

  • August 13, 2024
  • 1 reply
  • 875 views

I want to assign the value of this replaced value back to the same variable.

{%= replaceAll(itin_1_img_alt,"-"," ") %}
 
something like,
  {% let itin_1_img_alt = "This-is-my-ALT-tag" %}
  {%  itin_1_img_alt = replaceAll(itin_1_img_alt,"-"," ") %}
 
Thanks,
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SatheeskannaK

@georgevi2 Try this,

{% let itin_1_img_alt = "This-is-my-ALT-tag" %}
{% let itin_1_img_alt = replaceAll(itin_1_img_alt,"-"," ") %}
{%= itin_1_img_alt %}

1 reply

SatheeskannaK
Community Advisor
SatheeskannaKCommunity AdvisorAccepted solution
Community Advisor
August 14, 2024

@georgevi2 Try this,

{% let itin_1_img_alt = "This-is-my-ALT-tag" %}
{% let itin_1_img_alt = replaceAll(itin_1_img_alt,"-"," ") %}
{%= itin_1_img_alt %}

Thanks, Sathees
GeorgeVi2Author
Level 2
August 14, 2024

That worked, thank you.

Adobe Employee
August 16, 2024

@georgevi2  - you should also take a look at recent improvements that provide the ability to set global variables in expression fragments that can be replaced easily: 

Customizable fragments | Adobe Journey Optimizer