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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
DriscollBunt
Contributor
Contributor

implicit context didn't construct code correctly when integrates with routine.

Regarding https://www.talend.com/blog/2019/02/28/best-practices-for-using-context-variables-with-talend-part-3...

I defined TalendContextTableName and TalendContextSchema on properties file.

Implicite context, I defined routines.ImplicitContextUtils.getImplicitContextParameterValue("TalendContextSchema",rootPid,pid) on Schema and routines.ImplicitContextUtils.getImplicitContextParameterValue("TalendContextTableName",rootPid,pid) on Table Name.

On job, I switch to Code view and found it constructs a wrong java code as following.

String dbquery_Implicit_Context_Database = "SELECT \n  \"routines.ImplicitContextUtils.getImplicitContextParameterValue("TalendContextSchema",rootPid,pid)\".\"_MyTable_\".\"key\", \n  \"routines.ImplicitContextUtils.getImplicitContextParameterValue("TalendContextSchema",rootPid,pid)\".\"_MyTable_\".\"value\"\nFROM \"routines.ImplicitContextUtils.getImplicitContextParameterValue("TalendContextSchema",rootPid,pid)\".\"_MyTable_\""+" WHERE "+routines.ImplicitContextUtils.getImplicitContextParameterValue("TalendContextEnvironment",rootPid,pid);

 

Do we have another way to let Talend Open Studio Version: 7.1.1 constructs the java code correctly when using routine define in parameter in implicit context?

 

Best regards,

Jeans

 

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi @JeansBunt,

 

Thanks for looking at my blog and for highlighting this. I was using a MySQL database when I was writing this and did not have to specify a schema. I also, by pure chance, hard coded my table name. I therefore did not spot this problem. 

 

It turns out that the table name and schema do not appear to permit the calling of Java methods. They take whatever is written in those fields as literal values. This is rather frustrating, but does not stop you from making use of this functionality. It just means that you will need to hard code the table name and schema, leaving everything else dynamic. 

 

Sorry that I did not cover this in my tutorial. As I said, I will go back a edit this to make sure this is made clear. Thank you for highlighting it

 

@xdshi the link that was supplied is this one....

https://www.talend.com/blog/2019/02/28/best-practices-for-using-context-variables-with-talend-part-3

It looks like some extra url parameters were attached to the end 

 

View solution in original post

4 Replies
Anonymous
Not applicable

Hello,

This link you provided navigates to error page.

Do you want to implement data encryption/decryption feature using Context Framework?

Best regards

Sabrina

Anonymous
Not applicable

Hi @JeansBunt,

 

Thanks for looking at my blog and for highlighting this. I was using a MySQL database when I was writing this and did not have to specify a schema. I also, by pure chance, hard coded my table name. I therefore did not spot this problem. 

 

It turns out that the table name and schema do not appear to permit the calling of Java methods. They take whatever is written in those fields as literal values. This is rather frustrating, but does not stop you from making use of this functionality. It just means that you will need to hard code the table name and schema, leaving everything else dynamic. 

 

Sorry that I did not cover this in my tutorial. As I said, I will go back a edit this to make sure this is made clear. Thank you for highlighting it

 

@xdshi the link that was supplied is this one....

https://www.talend.com/blog/2019/02/28/best-practices-for-using-context-variables-with-talend-part-3

It looks like some extra url parameters were attached to the end 

 

DriscollBunt
Contributor
Contributor
Author

Hi @rhall,

 

Thank you for explanation. I agree with you that we need hard code to define a table_name.

 

However, your blog is really useful to support dynamics switch the job between environment by simply change ENV value. I'm appreciate your sharing. 

 

Hi @xdshi ,

Thank you for your reply. This link was updated by @rhall .

 

Best regards

Jeans

DriscollBunt
Contributor
Contributor
Author

Hi @xdshi ,
Thank you for your reply. This link was updated by @rhall .

In this case, I followed list of steps about best practices for using context variables that developed by @rhall. My issue struck on I'm unable to define table name as variable that passing from user define routine.

However, encrypt/decrypt is working fine using jasypt-1.9.2.

Best regards,
Jeans