Passing Implicit context variables to the Source Query

Five Stars

Passing Implicit context variables to the Source Query

Hi All,

 

Please let me know on how to handle the below scenario

My plan is to load data from a Source table based on a date value, In my current setup I'm using Implicit context variables (Pulling context variables from Database).

 

I'm using the LastRunDate context variable from the context variable table and using it in my source query, But this is not working, 

something like the below query

Please note that the source is Oracle and hence the query is formatted to match Oracle query standards

"select * from table where create_date > TO_DATE("+context.LastRunDate+",'MON DD YYYY HH:MIAM')"

LastRunDate is stored as varchar in the context variable table in the following format 'MON DD YYYY HH:MIAM'

 

Appreciate your help

Thanks

 

 

 

 

 

However, this is not working, I'm able to see the context variable LastRunDate

 

 

 

 

 

 

 

 

 

 

Community Manager

Re: Passing Implicit context variables to the Source Query

Your query should be as follows......

 

"select * from table where create_date > TO_DATE('"+context.LastRunDate+"','MON DD YYYY HH:MIAM')"

I haven't tested this (you will need to check that the query works in Oracle), but you certainly missed the single quotes around your "LastRunDate" context. Your String concatenation looks OK, but if "LastRunDate" is a Varchar, you will need to supply it to the query with single quotes (') around it. I've added them above.

Five Stars

Re: Passing Implicit context variables to the Source Query

Sorry guys, this is a false alarm

This basically because of issue with me putting in wrong context value (case sensitive value).

I checked it now and it works fine.

THanks

2019 GARNER 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

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Downloads and Trials

Test drive Talend's enterprise products.

Downloads