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
Fifteen Stars TRF
Fifteen 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
Highlighted
Fifteen Stars TRF
Fifteen 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

Fifteen Stars TRF
Fifteen 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?

Fifteen Stars TRF
Fifteen 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

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

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

Why Companies Move to the Cloud: 7 Success Stories

Learn how and why companies are moving to the Cloud

Read Now