Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Sanjay5
Contributor III
Contributor III

Process String Array Data

Hi,

 

I have a field with data type String Array and I am looking for some way to handle this in my Job.

I don't see data type as "String Array" in any of the components.

 

Is there a way to handle String Array in Talend?

 

Thanks,

Sanjay

Labels (2)
1 Solution

Accepted Solutions
Jesperrekuh
Creator III
Creator III

Some ideas ...
- your NameArray as an Object, which you cast to a String[]? That's what the example is... you could declare almost everything as an Object because its the super/parent of many non primitive datatypes ...
or
- tJavaFlex, do it in Java code... create/build the json yourself .
or
-look on talend exchange for tJSONDoc components... pretty advanced however I never used an array like this...

The output part is a whole different story... again try the JSONDoc components or tJavaFlex.

View solution in original post

6 Replies
Jesperrekuh
Creator III
Creator III

No such component.

You can do it yourself, this is how I declare it in a tContext global variable which is an Object.

(new String[] {"something","something"})

If you want to make something flexible you probably end up using tJava, tJavaRow, tJavaFlex.

 

Sanjay5
Contributor III
Contributor III
Author

Thanks Dijke,

 

I did not get how to process the String Array, Would you mind providing me few screen shots.

 

Regards,

Sanjay

Jesperrekuh
Creator III
Creator III

An example... not how I exactly use it, just to give you an idea how to. 

The purpose for what I used an array was to reduce parameters and store it all together in one variable, it was more an experiment not very practical and useful... 

But I figured out how I could use arrays 0683p000009MACn.png

0683p000009LzMO.png

Sanjay5
Contributor III
Contributor III
Author

Thanks for your detailed explanation and useful trick to handle String Array, Unfortunately my requirement is little different.

I have a couchbase database which stores the data in the form of String Array and I am supposed to read it and process in Talend job.

After processing i am supposed to load the String Array back to Couchbase.

 

0683p000009LzRa.jpg

 

The issue is that i don't have any Data Type for String Array in Talend. 

So not able to process  String Array.

Jesperrekuh
Creator III
Creator III

Some ideas ...
- your NameArray as an Object, which you cast to a String[]? That's what the example is... you could declare almost everything as an Object because its the super/parent of many non primitive datatypes ...
or
- tJavaFlex, do it in Java code... create/build the json yourself .
or
-look on talend exchange for tJSONDoc components... pretty advanced however I never used an array like this...

The output part is a whole different story... again try the JSONDoc components or tJavaFlex.
Sanjay5
Contributor III
Contributor III
Author

Looks like treating String Array as Object would work for me.

 

Thanks for your Ideas 0683p000009MACn.png