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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
brpaula_
Contributor
Contributor

Context Var with HTML Code from database

I'm trayng to create a routine to send e-mail with HTML content (it may not be the best way, but it's a test).

I am storing part of the HTML code in a database in text format. In this part of the code I have a talend context variable to facilitate the reuse in multiple e-mails.

When I try to use that part of the code to send the e-mail, talend doesn't recognize the variable's content and it appears as "text" in the e-mail.

Is there a way that when I bring the code from the database, talend recognizes the variable and its content.

Atached more informations and images.tjava

tjava:

0695b00000kWG7GAAW.png

tsendmail:

0695b00000kWG8JAAW.png

Part of “context.cabecalho” contente

0695b00000kWG9MAAW.png

e-mail result

0695b00000kWG9qAAG.png

Labels (2)
2 Replies
anselmopeixoto
Partner - Creator III
Partner - Creator III

Olá @Bruno Rocha​ 

 

Unfortunately, setting up a context variable using this approach won't work because you're trying to set part of Job's code at runtime.

 

What you can do, however, is to use "context.routinedescription" on your input HTML as a placeholder.

 

Considering the HTML code provided in you example, you could use String replaceAll method to replace that placeholder with the actual value stored in the context variable with the same name.

 

For example, you can put this code on your tMap_2 output:

 

row3.meuCodigoHtml.replaceAll("context\\.descricaoRotina", context.descricaoRotina) // please notice that here you're replacing a String "context.descricaoRotina" with the value stored in context.descricaoRotina variable

 

Espero que isso te ajude.

brpaula_
Contributor
Contributor
Author

Good ideia, i will try this.

 

thanks @Anselmo Peixoto​ .