Access to context variables in Hierarchical Mapper (tHMap)

One Star

Access to context variables in Hierarchical Mapper (tHMap)

I have a job with tHMap to transform data from JSON to XML. During filling XML I want to perform DatabaseLookup. So in Hierarchical Mapper view I added new Database. I filled database information with hardcoded (fixed) connection properties.  And that's work - job locally is working fine.
But I want to provide in database information (connection properties) data from Context - for example host will be changing for different environments.
Is any way I could achieve such a thing?  
Moderator

Re: Access to context variables in Hierarchical Mapper (tHMap)

Hi,
From your description, it seems that you are looking for tContextLoad which can be used to load a context from a flow.
Please see the scenario in component reference:TalendHelpCenter:tContextLoad
Feel free to let us know if it is what you are looking for.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Access to context variables in Hierarchical Mapper (tHMap)

Hello Sabrina,
how can I access the context variables from the mapping perspective? and why can't I upload anything to your website?
thanks
Rajani
Employee

Re: Access to context variables in Hierarchical Mapper (tHMap)

In the data mapper, use the function GetMapProperty under the Special folder.  Drag it to where you want to use it and the type in the context variable name as "context.variable".  You do not need the quotes.