Search code examples
talendtalend-mdm

How to set ts3Get key field dynamically in Talend?


I have extracted file name from tSQSInput using a tExtractJSONFields component and logged it on to the console using tLogRow. How can I pass this value to the "key" field in tS3Get component?


Solution

  • You can use either a context variable or a globalVariable

    tSQSInput-->tExtractJsonFields-->TjavaRow
    

    in tJavarow , set :

    context.myKey=input_row.inputkey;
    

    or

    global.put("mykey",input_row.inputkey);
    

    ("inputkey" being the fieldname for your key)

    Then in tS3Get (which you can link through a onSubJobOK), you can use the variable in the right field context.myKey or ((String)globalMap.get("mykey"))

    If you use context variable make sure you declared it on the 'context' tab of your job.