Using query output as a variable

Five Stars

Using query output as a variable

Hi,

I have a Terdata query of count rows from specific table and i would like to use the result of the query as a variable/context afterwards on the Talend job.

How can I do this?

 

Thanks


Accepted Solutions
Forteen Stars TRF
Forteen Stars

Re: Using query output as a variable

tJavaRow:
context.yourVariable = input_row.yourField;

tSetGlobalVar:
Just connect it to the DB component. It will create a global variable for you with a name based on the flow + the field name such as row1.yourField

TRF

All Replies
Forteen Stars TRF
Forteen Stars

Re: Using query output as a variable

Push the result to a tJavaRow to populate the context variable.

You may also push the result to a tSetGlobalVar if you want to use a global variable instead of a context variable.


TRF
Five Stars

Re: Using query output as a variable

Can you please elaborate about using this components as I'm not famailier with them?

What should I write in them?

 

Thanks

Forteen Stars TRF
Forteen Stars

Re: Using query output as a variable

tJavaRow:
context.yourVariable = input_row.yourField;

tSetGlobalVar:
Just connect it to the DB component. It will create a global variable for you with a name based on the flow + the field name such as row1.yourField

TRF
Five Stars

Re: Using query output as a variable

"yourfield" should be the column name that i want to use?

Highlighted
Forteen Stars TRF
Forteen Stars

Re: Using query output as a variable

Yes

TRF
Five Stars

Re: Using query output as a variable

Thanks a lot, it worked! Smiley Happy

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.