[resolved] How to use the Dynamic Settings for tHDFS components?

One Star

[resolved] How to use the Dynamic Settings for tHDFS components?

I opened the dynamic settings and clicked the green plus sign. This gives me:

I have tried to fill the "Code" box with the following:
(context.is_test ? "tHDFSConnection_1" : "tHDFSConnection_2")
(context.is_test ? tHDFSConnection_1 : tHDFSConnection_2)
context.hdfs_connection
(I tried making context.hdfs_connection a string with the value of "tHDFSConnection_2")
None of these worked, as when I clicked on Basic Settings and then back to Dynamic Settings, the value was reverted to tHDFSConnection_1.
How may I get this to work?
Regards,
Matthew
Community Manager

Re: [resolved] How to use the Dynamic Settings for tHDFS components?

Hi Matthew 
The dynamic settings tab don't support context variables.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] How to use the Dynamic Settings for tHDFS components?

I am facing the same issue under tMySQLInput and the settings revert automatically. 
While you are on the Dynamic Settings tab the Code works fine. For Example : This works and picks the connection from Global Map.
" + globalMap.get("conn2") + "
Associated Java Code also seems fine.
java.sql.Connection conn_tMysqlInput_1 = null;
conn_tMysqlInput_1 = (java.sql.Connection) globalMap.get("conn_" + globalMap.get("conn2") + "");
But as soon as you switch Tab, the value in dynamic tab reverts to tMysqlConnection_1 and also the java code.
One Star

Re: [resolved] How to use the Dynamic Settings for tHDFS components?

I am facing the same issue under tMySQLInput and the settings revert automatically. 
While you are on the Dynamic Settings tab the Code works fine. For Example : This works and picks the connection from Global Map.
" + globalMap.get("conn2") + "
Associated Java Code also seems fine.
java.sql.Connection conn_tMysqlInput_1 = null;
conn_tMysqlInput_1 = (java.sql.Connection) globalMap.get("conn_" + globalMap.get("conn2") + "");
But as soon as you switch Tab, the value in dynamic tab reverts to tMysqlConnection_1 and also the java code.

Hi Shong,
I have a similar requirement as chitwan.
I have a job that I wish to be able to use two different Oracle Databases depending on the context variable I pass to it. One of the DBs uses the Oracle Service Name, whereas the other uses a Oracle SID:


I would need to have two different tOracleConnections in a single job to do this.
How would I go about dynamically assigning my tOracleInput/Outputs to use a particular tOracleConnection based on a context variable?
Thanks and best regards,
Matthew
One Star

Re: [resolved] How to use the Dynamic Settings for tHDFS components?

This is exactly as explained in 
Scenario 3: Reading data from MySQL databases through context-based dynamic connections

help.talend.com/display/TalendComponentsReferenceGuide54EN/tMysqlInput

And as mentioned here, that this should not only allow context variable, it should allow any code.

help.talend.com/display/TalendOpenStudioforBigDataUserGuide55EN/3.2.6+How+to+define+component+properties
As code, you can input a context variable or a piece of Java code.
One Star

Re: [resolved] How to use the Dynamic Settings for tHDFS components?

But not working the way its explained, or we are missing something.
One Star

Re: [resolved] How to use the Dynamic Settings for tHDFS components?

Good News. 
Its working as expected in Version: 5.6.1
Build id: V5.6.1_20141207_1530
One Star

Re: [resolved] How to use the Dynamic Settings for tHDFS components?

Good News. 
Its working as expected in Version: 5.6.1
Build id: V5.6.1_20141207_1530

Awesome. Thanks for the heads up Chitwan.