Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
czuriaga
Contributor
Contributor

How to use a context variable in a tMap

I have a context variable, that is context.fixed_hours = 10
In a tMap I want to create a new field "New_Hours" using the formula    "row12.Hours - context.fixed_hours"
But if I try to run the job, I get an error "fixed_hours cannnot be resolved or is not a field"
How can I use my context variable inside a tMap?
Thanks!
Labels (2)
3 Replies
Anonymous
Not applicable

Can you take a screenshot of what you are doing in the tMap? It should work, but without seeing it we can't let you know what is wrong. Also, are you sure you have created the context variable in your job and not created it in a Context Group? If it is in the Context Group then it will need adding to your job.
czuriaga
Contributor
Contributor
Author

I was completely sure the variable had been added to the context group of the job, but the auto-complete tool in the expression builder didn't offer that variable as option.
While preparing the example to capture the screenshots, I noticed the variable was an option to choose after writing "context.", then I tried in my production job and worked!!
row12.Hours - context.fixed_hours
Thanks, everything is solved, context variables can be used in tMaps (adding the variable to the context group of the job, of course)
Thanks!
Anonymous
Not applicable

Hi Everyone! 

I've encountered an issue with using context variables in tMap expression builder. When I push a test button it gives me an error. Please find the screen attached.

I would be really appreciated for any suggestions!

 

Thanks in advance! 


ContextVarTestInExpressionBuilder.PNG