Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tJavaRow inserting data collection (array) into tXMLMap column

Hi everyone, I'm getting some trouble when I try to insert data from tJavaRow in a column from tXMLMap. These columns in tXMLMap should be an array 

1 - I tried to iterate and insert data into output_row[count], but I can't because "confidence" column isn't an array
for(int count = 0; count < results.getAlternatives().size(); count++)	{

// Get object by current count
SpeechReturnDTO speech = (SpeechReturnDTO) results.getAlternatives().toArray()[count];

// Inserting value into tXMLMap
output_row.confidence[count] = speech.getConfidence();
output_row.transcript[count] = speech.getTranscript();

}


2 - I tried to create a body column with some elements, but I couldn't access the variables using tJavaRow
for(int count = 0; count < results.getAlternatives().size(); count++)	{

// Get object by current count
SpeechReturnDTO speech = (SpeechReturnDTO) results.getAlternatives().toArray()[count];

// Inserting value into tXMLMap
output_row.body.result.alternative[count].confidence = speech.getConfidence();
output_row.body.result.alternative[count].transcript = speech.getTranscript();



Does anyone can help me to fix this problem?

Thanks in advance



I've attached files to more information




0683p000009MG9P.png 0683p000009MG18.png 0683p000009MG9L.png
Labels (4)
3 Replies
Anonymous
Not applicable
Author

Hi 
What are your input data? What are your expected result? I DON'T know why you need to hard code on tJavaRow, can you please explain your requirement with more details?

Regards
Shong
Anonymous
Not applicable
Author

I'm integrating my software with Google Speech to Text Api. 
1 - I make an HTTP request POST to Talend sending 2 datas: audio file and language as input
2 - Process data using my library in tJavaRow component and iterate with collection result 
3 - Inside the iteration (tJavaRow) I would like to insert current data from iteration in a  "array variable" inside tXMLMap, but I can't because when I try to access "output_row.confidence[0]", it IS NOT an array.

For instance:
I have two data and I need to put the same data inside a tXMLMap
Input (tJavaRow) ->    alternative[0] = { confidence = 0.954564, transcript = "Hi how are you"}
                               alternative[1] = { confidence = 0.846132, transcript = "I'm testing" }
Output (tXMLMap) ->  (the same data above)

I need something like this: 
// Copying first data
output_row[0].confidence = alternative[0].confidence;
output_row[0].transcript = alternative[0].transcript;

// Copying second data
output_row[1].confidence = alternative[1].confidence;
output_row[1].confidence = alternative[1].confidence;

// and so on...

 Let me know if I could be clearer with my question.
 Thanks in advance


    

            
                 
Anonymous
Not applicable
Author

Hi
The output column is not an array, I suggest you to iterate each item and append it to a string (eg: confidence1,confidence2,...) as output column on tJavaRow, and then normalize this column with tNormalize component to becomes:
other column;confidence1;transcript1
other column;confidence2;transcript2
other column;confidence3;transcript3

Regards
Shong