Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
pawe84
Creator
Creator

modify html file, replace image src

Hi Talend geeks,

 

if I use tFileInputRaw on a html file as string can I modify the string in order to replace inside the

image tag the path to another url, to <img src="https://example/content/header.jpg" style="width: 538px" alt=""/></td>?

pawe84_0-1716889885929.png

If yes, how to replace the substring?

Labels (1)
  • v8.x

1 Solution

Accepted Solutions
Shicong_Hong
Employee
Employee

Hello 

Try this code on tJavaRow to replace "folder/header.jpg" with "https://example/content/header.jpg", and assign the new string to a context variable for used later on tSendMail. 

//Code generated according to input schema and output schema
context.varName= input_row.content.toString().replace("folder/header.jpg","https://example/content/header.jpg");

System.out.println(context.varName);

Shicong_Hong_0-1716958398927.png

 

Regards

Shicong

View solution in original post

2 Replies
Shicong_Hong
Employee
Employee

Hello 

Try this code on tJavaRow to replace "folder/header.jpg" with "https://example/content/header.jpg", and assign the new string to a context variable for used later on tSendMail. 

//Code generated according to input schema and output schema
context.varName= input_row.content.toString().replace("folder/header.jpg","https://example/content/header.jpg");

System.out.println(context.varName);

Shicong_Hong_0-1716958398927.png

 

Regards

Shicong

pawe84
Creator
Creator
Author

Thanks a lot, instead of tSendMail I put behind tJavaRow --> tFileOutputRaw and then tSendMail.

So I can iterate all my html, modify and send it.