Variable manipulation

Hi all
i need to update a target system from a source system an operate between some transformations.
i receive code that i translate by a tiers system to update the target.
I receive this :
“Rawdata”: [“fsc_label_mixte”,“fsc_label_recycled”]
rawdata can be 2 or more item.

and i need this :
“data”: [“Mixte”,“Recyclé”]

i can split the raw data to call the “translate API” but i don’t understand how can i build the final array.

thanks

Hey @Christel_Doudet,

I’ve created an example workflow that might help you

Hi @harshil1712 ,
you just use some string functions. It’s not so simple. The label is not an simple extract of the code, i am obliged to call an external API to get the meaning of the code.

Hey @Christel_Doudet!

Can you provide information? From the information you shared, I thought that you want to simply transform the strings.

@harshil1712 , sorry i thought the image was clear

From the rawdata and for each item in it, i have to call an api to get the label/meaning of this code in the right language and build the final array
/ex : [“fsc_label recycled”] = [“Recyclé”]
/ex : [gar_1*] = [“Garantie 1an Renouvelable”]
/ex : [“com_plus_produit_fab_france”,“com_plus_produit_aj_france”] = [“Made in France”,“Shade Made in France”]
thanks

Hey @Christel_Doudet,

Thank you for making it clear :slight_smile:

Are you able to call your Translate API for each item within the array? If I understand your question correctly, you need help with transforming the data after into an array after it is translated. Am I missing something?

Yes it’s like this, i must call “com_plus_produit_fab_france”, then “com_plus_produit_aj_france”, and build the result in an array.

For now i can’t even split the rawdata Rawdata: [“fsc_label_mixte”,“fsc_label_recycled”].

Thank you for clearing that.

It is expected that the SplitInBatches node is not splitting the rawdata since it is not following the n8n data structure. If you want to split the data, you will have to transform the data. Here’s the code snippet that might be useful: JavaScript Code Snippets | Docs

Once you have the data transformed into n8n’s data structure you can simply pass it to the API. You don’t need to split the data into batches. n8n will process all the individual items.

Hey @Christel_Doudet,

Did you resolve this?

Hi,
I was obliged to write a talend script and call it by the exec node.
It certainly be done in n8n with a function.

Did you write a Python script and executing that using the Execute Command node?

It’s a ETL TALEND job
https://community.talend.com/s/?language=en_US