Bi-Dimensional string array - Routine output to tJavaRow

Five Stars

Bi-Dimensional string array - Routine output to tJavaRow

Hello,

I'm facing an issue passign a multi dimensionall array from routine output to tJavaRow.

Scenario:

  • I've defined a routin with bi-dimensional string :

 

public static  String [][] post_text_login

 

  • In my routine I've several "for" nested cycles, setting array values on specific step:
for(int i=0;i<posts.size();i++)
        {
        	post_text[i] = posts.get(i).getElementsByClass("xxxt").text();
        	post_photo[i] = posts.get(i).getElementsByClass("_5dec _xcx").attr("data-ploi");
        	post_DT[i] = posts.get(i).getElementsByTag("abbr").attr("data-utime");
        };
        for(int j=0;j<posts.size();j++)
        {
        	ret_link[j][0]= post_text[j];
        	ret_link[j][1]= post_photo[j];
        	ret_link[j][2]= post_DT[j];
}
        
  • when I call the routine from the tJavaRow, loops are not working:
String [][]s =WebDriver_Selenium_3_8_1.post_text_login(x,x,x)

for(int i=0; i<10; i++) {
row14.post_text = s[i][0];
            row14.post_photo = s[i][1];
            row14.post_DT = s[i][2];
            row14.id_post = s[i][0];
 }

schema.JPG

 

How can I iterate trought the bi-dimensional array and cycle to rows?

 

Thank you

 

 

Sixteen Stars

Re: Bi-Dimensional string array - Routine output to tJavaRow

You to use the tJavaFlex for this. The Start Code section would have this code in it....

String [][]s =WebDriver_Selenium_3_8_1.post_text_login(x,x,x)

for(int i=0; i<10; i++) {

....... the Main Code would have this code in it......

row14.post_text = s[i][0];
row14.post_photo = s[i][1];
row14.post_DT = s[i][2];
row14.id_post = s[i][0];

...... and the End Code would have this code in it....

}

.....yes, you just close the loop here.

You cannot generate rows from a tJavaRow, it just processes each row passed to it. To generate rows the only Java component to use is the tJavaFlex.
Five Stars

Re: Bi-Dimensional string array - Routine output to tJavaRow

Hello,

thx for the tip.

I still have issue understandign how to pass variable from previous componet to tJavaFlex:

 

error.JPG

This it the code in the start part of tJavaFlex:

String [][]s =WebDriver_Selenium_3_8_1.post_text_login(XXX,YYY,row12.line);

row12.line is always null.

Thx

 

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.