Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi!
I want to give context variable value during runtime ,in tmap code will be like :
row5.context.myvalue.
Is this possible?
Please help.
Thanks!
Hi,
You can pass the value to context variables during run time. Please refer below post.
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Hi Nikhi,
I want to pass the value at job level while
manually running it , that too with in row1.name Instead of this u want to
give row1.context.name where I can give context value at run time.
It is throwing an error now , is there any other way that i could achieve this.
can you pls help @nthampi .
Thanks,
Alekya
Hi,
As per the @nthampi, yes we can pass context variable at run time. But you are stating as you are getting an error, please let us know what the actual error you are getting and what did you tried. If you let us know the details of your requirement, it will be easy to community members to give you the correct solution.
Hi Alekya,
You are trying to define the schema at run time. Since Talend uses schema based processing, you will have to write custom code to parse the data if your column details are changing at runtime. In this case, you will have to define a metadata in advance and based on the combination, you will have to dynamically build them using java codes.
I would approach this in slighlt different way. I would try to use file formats which are flexible in nature like JSON or XML and will define all the columns as tags in the definition. So if a column is not there, corresponding tag will not be there. But still we will be able to parse the data easily since our definition includes all the tags in advance.
Could you please try this method?
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Hi,
The JSON record looks like below. So you need to create a schema which will include all combination of columns.
{"name":"John", "age":31, "city":"New York", "zipcode":"12345"}
Once this schema is established, you can send the data with subset of it where some records will not have zipcode, some other without age etc.
End of day, even though your schema is fluctuating, you will have have an idea of the list of columns which can come to target database. So if you establish all these columns inside a JSON or XML, you can handle the data processing easily.
https://www.w3schools.com/js/js_json_intro.asp
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂