2

I'm trying to creating a download link using AMPscript to construct a complete URL.

Eg: original url link: "http://xxx.tempsite.Relatório/Mai19.pdf"

Where "Mai19", I use AMPscript to populate dynamically using HREF

Eg: HREF=(URL/ampcript.pdf) "click here to download"

Any suggestions are welcome

5

Try using CONCAT and setting the link as a variable

%%[
set @PDFVariable = "Mai19.pdf"
set @link = CONCAT("http://xxx.tempsite.Relatório/", @PDFVariable)
]%%

You can further make it dynamic with FormatDate or DatePart based on the date as I'm guessing you're trying to do with "Mai."

%%[ 
set @month = FormatDate(Now(),'MMMM')
set @year = FormatDate(Now(),'yy')
set @PDFVariable = CONCAT(@month, @year, ".pdf")
set @link = CONCAT("http://xxx.tempsite.Relatório/", @PDFVariable)
]%%
<a href="%%=RedirectTo(@link)=%%">click here to download</a>
2
  • Thank you Jackson! I just made some changes but it worked perfectly! Jul 8 '19 at 12:01
  • Good to hear! Please select my answer as the accepted answer. Jul 8 '19 at 16:55

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.