To retrieve records that have a specific value based on a variable, you can use a tDBInput component
with a context variable in the SQL query. A context variable is a variable that can store a value that
can be changed at runtime or between different contexts. A context variable can be used in various
components to parameterize their properties or expressions. A tDBInput component is used to read
data from a database table by executing an SQL query. You can use a context variable in the SQL
query to filter the records based on a dynamic value. For example, if you have a context variable
named country that stores the value of the country you want to filter by, you can use it in the SQL
query of the tDBInput component as follows:
SELECT id, address, country FROM customers WHERE country = ‘context.country’
This will retrieve only the records that have the same value as the context variable country in the
country column.
You do not need to use a Run if trigger, a tMatchGroup component, or a tFilterColumns component
to achieve this. A Run if trigger is used to execute a subjob conditionally based on a logical
expression. A tMatchGroup component is used to group similar records based on matching rules and
output them as master or duplicate records. A tFilterColumns component is used to select or remove
columns from an input flow based on a list of column names. Reference: Talend Open Studio: Open-
source ETL and Free Data Integration | Talend, [Contexts - 7.3], [tDBInput properties - 7.3], [Run if
properties - 7.3], [tMatchGroup properties - 7.3], [tFilterColumns properties - 7.3]