tcontextload string doesnt load correctly

Highlighted
Three Stars

tcontextload string doesnt load correctly

Hi Talend community,

 

For a query i need the last_load datetime.

 

i did this using the following: tmssqlinput-> tcontextload. This works as expected

 

2019-12-12_14-52-05.png
The issue im facing is that the where statement in the query below does not get the correct value from the contextload.(if i copy and paste the value into the where statement it works as expected)
2019-12-12_14-54-13.png
Am i missing a step in the process, or is the query not written right?

Highlighted
Community Manager

Re: tcontextload string doesnt load correctly

Can you post a screenshot of your job? The flow of components is quite important when working with changing context variables. We need to see where the context variable value is changed and when the component using it is used. I suspect that your query has already been fired before the context variable value is set. By the way, you do not need to cast context variables. I assume you have set it as a String. As such, it is fine without the casting.

Highlighted
Four Stars

Re: tcontextload string doesnt load correctly

job.png
This is how the job looks at the moment

Highlighted
Eight Stars

Re: tcontextload string doesnt load correctly

Hi Henkiiee,

I guess single quote vs double quote is the problem...Talend looks for a " where as DB editors can work with a single quote('). In addition just ensure that your query when handed over as Dynamic SQL is in line with the underlying DB engine, for it to understand and execute.

Community Manager

Re: tcontextload string doesnt load correctly

Can you show your query in your DB component? You are showing it in another tool. 

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Put Massive Amounts of Data to Work

Learn how to make your data more available, reduce costs and cut your build time

Watch Now

How OTTO Utilizes Big Data to Deliver Personalized Experiences

Read about OTTO's experiences with Big Data and Personalized Experiences

Blog