Setting a database value to context variable in talend

孤街醉人 提交于 2019-12-01 14:24:03
Shanmuga Priya
  1. Select distinct username from table.
  2. Use tFlowToIterate to iterate on each of the usernames. (connect table component to this component using main link)
  3. Use Iterate link to connect to tJava component.
  4. Assign the username to context variable using tjava component. For eg. if output row from the table component is row1, then context.username=row1.username.
  5. Connect tJava to a table component using 'OnComponentOk' to Select data from table based on the where condition: username='"+context variable+"'
  6. Write data into file. Give filename as "<path>\"+context.username.
Michael Dam

tYOURDBInput -> [row1] -> tFlowToItterate -> [itterate] -> tJava -> "globalMap.put("DESC", (String)row1.column);"

If you have just the one line then pick it up elsewhere via

(String) globalMap.get("DESC")

I used this setup to retrieve passwords to foreign systems stored in a table which are to be refreshed regurarily. This prevents code rebuilds everytime the password changes. Do protect your table naturally.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!