Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tDBInput for each previous tDBInput row ?

Hello,

 

I need to fetch all users and the list of their orders (linked by a user_id field )

 

so the first tDBInput returns the users , but then how do I tell the second tDBInput the current user ID (..where user_id= some variable) ?

 

how can I set variables/parameters to a sub query ? do I have to use sub Jobs ? iteration links ?

 

can someone tell me how this is done ?

 

regards

Labels (2)
3 Replies
Anonymous
Not applicable
Author

Hi,

 

   The most robust way is to store the user ids to a temporary table and use inner join in second tDBInput to get only needed user ids. You can store the user ids to a context string variable and replace them in the IN clause of the query. But this approach is not scalable especially when the number of user ids go beyond 1000 in IN clause.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

Anonymous
Not applicable
Author

actualy I did it with tFlowToIterate component

Anonymous
Not applicable
Author

Hi Phil,

 

     You can follow that method also. But the only flip side with that approach is that you will be processing one record at a time in iterative fashion. So please do a performance test of the flow before moving it to production. If there are throughput issues, please create the flow as per my earlier post.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂