Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
As per my requirement i have added 2 context groups in my job. Attached is the screenshot of my job.
Context group names are DBConnection and SourceConnection.
My requirement is to get those group names and display on console. Is there any way to get Only context group names in Talend?
Please help me.
I'm afraid this is not possible.
As far as I know, context groups are here just to let you organize context variables into the Studio.
As a workaround you could make another context group called "ContextGroups", with a variable called "ContextGroupsList". You could put your context group names in the list and then display the list on the console.
Thank you bilimmer. I will try to implement your approach.
Hi All,
Is there any other approach to get context group name.
Please help me.
Thanks,
Divya
As TRF said, no but maybe you could prefix your context variable names with the name of the context group? Like:
Context group DBConnection
DBConnection_dbName
DBConnection_dbUser
DBConnection_...
Context group SourceConnection
SourceConnection_ip
SourceConnection_url
SourceConnection_...
This would work as you can use java reflection to read your variable names, and strip everything after the first underscore...
Thanks bilimmer. Instead of updating context variable names Is it possible to dynamically get the group name?
No. But you really have me curious about the use case here. What are you trying to do? What purpose does printing the context group names in the console serve? With more information we could suggest another approach?