Processing Dynamic URL data with tRestClient

Five Stars

Processing Dynamic URL data with tRestClient

Hi Team,

 

I am trying to update the Slack API URL with particular channel_id ( we already inserted in oracle table) through tRestClient component.
 
What i have done is updated the context variable with tJava and using that context variable in URL. Below are the attachment for the same( image and image(1)):-
 
The problem with this approach is, output i am getting is from the last updated channel_id in the context variable.
Below image(2), we are getting two channel_id's ( as i am fetching only these two from oracle)
from tJava.
 
But output from the URL is for the last updated channel_id that is CQ74QNGG5. Can anyone help me in this ??
 
 
Community Manager

Re: Processing Dynamic URL data with tRestClient

Change your tJava to a tJavaFlex and join it using a "row" to the tRestClient. Keep the code the same. Your problem is being caused by the fact that the first subjob is running completely before your tRestClient is running. By joining the flows, you can get the tRestClient to run for every iteration.

Five Stars

Re: Processing Dynamic URL data with tRestClient

It worked, with the tLogRow. As you can see in  the images of two channels. But in the oracle while inserting i am getting only one channel data that is CQ74QNGG5 channel. Last image is of oracle data. I am not able to get the reason, why it is.

Community Manager

Re: Processing Dynamic URL data with tRestClient

You are not inserting to Oracle in the screenshots that I have seen. When is this happening? Also, would you be able to add your images to the main body of the post. The "Photos" button allows you to do that. It can be quite difficult to work with images that need to be downloaded and viewed in a separate window.

Five Stars

Re: Processing Dynamic URL data with tRestClient

Okay, I will do that. Actually I was using truncate table with reuse storage in Action on table, that's why i think on second iteration it will truncate the records and then insert the latest one.

 

By Removing the truncate table option to default, i am able to insert records. But i can manage both, iteration process and when i run again it should truncate data and load again in DB.

 

 

Community Manager

Re: Processing Dynamic URL data with tRestClient

You are correct. When you have an iterate link in your flow, all components following that Iterate link are restarted for every iteration. As your DB component was restarted for every link, it will have truncated everything that was there prior to the restart

Five Stars

Re: Processing Dynamic URL data with tRestClient

Agreed, but with this, when i run my job again the data got appended again. So is there any other way, i can truncate the table without effecting my iteration logic.

Community Manager

Re: Processing Dynamic URL data with tRestClient

Truncate it at the beginning of the Job. The first step of the Job should be the truncation step, then everything else will follow

Five Stars

Re: Processing Dynamic URL data with tRestClient

How to truncate the job at the beginning, should i need to write some custom code or sql query while i am fetching the data.

 

Below is the image how i am fetching the data from oracle

 

Oracle_data_fetching.PNG

Community Manager

Re: Processing Dynamic URL data with tRestClient

Use a tDBRow and write the truncate statement in that.

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 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 3

Read about some useful Context Variable ideas

Blog