Two Stars

Create a list of string from tlogRow and use it in a query

Hello Community,

 

I am using Talend to transfert data from one salesforce organization to another one.

Due to salesforce limitations i need to insert an object and use the recently inserted IDs to request the auto-gerated fields created on the records during the insertion.

 

I managed to get the inserted Ids but i'm stuck on making them into a list that i can use in a query after that. (my job below)

image.png
In the tlogrow i get my IDs, same as in the tfileoutput now in the second ContentVersion i want to request on those ids.

image.png

 

The result of this query on salesforce is :"Select id ContentDocumentId FROM ContentVersion where id in (null)"

I would like this null to be the list of id i get in the tlogrow or tfileoutputDelimited.
Is is possible?

Thanks in advance


 

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Twelve Stars TRF
Twelve Stars

Re: Create a list of string from tlogRow and use it in a query

Hi,

Add a tJavaRow after your tFileOutputDelimited to construct a global variable with the list if ids.

Then you'll be able to reuse this global variable in your next tSalesforceInput component.

Hope this helps.


TRF
4 REPLIES
Twelve Stars TRF
Twelve Stars

Re: Create a list of string from tlogRow and use it in a query

Hi,

Add a tJavaRow after your tFileOutputDelimited to construct a global variable with the list if ids.

Then you'll be able to reuse this global variable in your next tSalesforceInput component.

Hope this helps.


TRF
Four Stars

Re: Create a list of string from tlogRow and use it in a query

 

In My opinion you could use a tReplicate in order to split one flow to multiple flows...

flow n° 1  to create the first file

flow n°2 to query and than write the second file

 

cheers

Two Stars

Re: Create a list of string from tlogRow and use it in a query

Thanks! That's it, i used a tjavarow with a global variable, then used it in my TSalesforceInput component.
That works fine, but i still have an issue:
my tJavaRow create a String with all the IDs.
I would like to create a list of string as variable (in order to bypass the limit for SOQL query in my tsalesforceinput).

Here is my tjavarow (with the end of the job, i used tHashinput/output but that's not a issue here)image.png

 

I just want test2 (which is my global variable) to be a list of string. Is it possible to do that?

Twelve Stars TRF
Twelve Stars

Re: Create a list of string from tlogRow and use it in a query

Hi,

Yes, you may create a list (or an array) of strings in the tJavaRow.

In this case, you'll have to iterate over the list (or the array).

Consider the following representation of your list:

"'id001','id002',...,'id00n'"
"'id011','id012',...,'id01n'"
...
"'id101','id102',...,'id10n'"

Using a tLoop component you'll call your tSalesforceOutput for each member of the list, and that's it!

 

Don't forget to mark your case solved if it is.

Kudos also accepted!


TRF