<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic TjavaFlex output issue in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/TjavaFlex-output-issue/m-p/2260247#M41435</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Below you can see the result of a query, with list of date in string&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;.-----------+------------+-----------------------------------------------------------------+----------------------------+-----------------------------.
|                                                                            tLogRow_2                                                                |
|=----------+------------+-----------------------------------------------------------------+----------------------------+----------------------------=|
|editorName |ProductName |end_date_resorption_versions                                     |end_date_supported_versions |end_date_recommended_versions|
|=----------+------------+-----------------------------------------------------------------+----------------------------+----------------------------=|
|EditorA    |PN_A	 |31/03/2017,31/03/2017,31/03/2017,31/03/2017,31/03/2017,31/03/2017|null                        |null                         |
|EditorA    |PN_A	 |30/06/2024                                                       |null                        |30/06/2024                   |
|EditorA    |PN_A	 |30/11/2020,30/06/2017                                            |null                        |null                         |
|EditorA    |PN_A	 |null                                                             |30/06/2024                  |null                         |
|EditorA    |PN_A        |null                                                             |null                        |null                         |
|EditorA    |PN_A	 |30/11/2020,30/11/2020                                            |null                        |null                         |
|EditorB    |PN_B	 |18/05/2017,31/03/2017,31/01/20                                   |null                        |null                         |
|EditorB    |PN_B	 |03/06/2024                                                       |01/02/2020                  |30/06/2024                   |
|EditorB    |PN_B	 |23/12/2014			                                   |null                        |null                         |
|EditorB    |PN_B	 |null                                                             |01/02/2020                  |30/06/2020                   |
|EditorB    |PN_B	 |null                                                             |null                        |null                         |
|EditorB    |PN_B	 |12/12/2012,31/12/2020                                            |null                        |13/01/2020                   |
'-----------+------------------------+-----------------------------------------------------+----------------------------+-----------------------------'&lt;/PRE&gt; 
&lt;P&gt;Here's the result I want to get :&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;.-----------+------------------------+-----------------------------------------------------------------+-------------.
|                                                                            tLogRow_10                               |
|=----------+------------------------+-----------------------------------------------------------------+-------------=|
|editorName |ProductName  |end_date_resorption_versions   |end_date_supported_versions |end_date_recommended_versions|
|=----------+-------------+-------------------------------+----------------------------+----------------------------=|
|EditorA    |PN_A	  |31/03/2017		          |30/06/2024		       |30/06/2024 		     |
|EditorB    |PN_B         |31/01/2012                     |01/02/2020		       |13/01/2020 		     |
'-----------+-------------+-------------------------------+----------------------------+-----------------------------'&lt;/PRE&gt; 
&lt;P&gt;I want for each column find the min date.&lt;/P&gt; 
&lt;P&gt;12 rows in input -&amp;gt; 2 rows in outputs&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;My approach is this:&lt;BR /&gt;First, by column, I store all the values in an array&lt;BR /&gt;In a second step, I convert the dates which are in STRING to DATE.&lt;BR /&gt;In a third step, I retrieve for each column the date min.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tjavaFlex_jobDesign.png" style="width: 520px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009Ma83.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/144037iB73334BEA140A30C/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009Ma83.png" alt="0683p000009Ma83.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;So i to try to get the result i wanted : i used tJavaFlex&lt;/P&gt; 
&lt;P&gt;Start code :&lt;/P&gt; 
&lt;PRE&gt;SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");

// Array for end_date_resorption_versions
List&amp;lt;String&amp;gt; myStringList_edrv = new ArrayList&amp;lt;&amp;gt;();
List&amp;lt;Date&amp;gt; dates = new ArrayList&amp;lt;&amp;gt;();

// Array for end_date_supported_versions
List&amp;lt;String&amp;gt; myStringList_edsv = new ArrayList&amp;lt;&amp;gt;();
List&amp;lt;Date&amp;gt; dates_edsv = new ArrayList&amp;lt;&amp;gt;();

// Array for end_date_recommended_versions
List&amp;lt;String&amp;gt; myStringList_edrev = new ArrayList&amp;lt;&amp;gt;();
List&amp;lt;Date&amp;gt; dates_edrev = new ArrayList&amp;lt;&amp;gt;();&lt;/PRE&gt; 
&lt;P&gt;Main code&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;if (row4.end_date_resorption_versions == null ){
		row4.end_date_resorption_versions  = "31/12/2099";
	}
if (row4.end_date_supported_versions == null ){		
		row4.end_date_supported_versions   = "31/12/2099";
	}
if (row4.end_date_recommended_versions == null) {
		row4.end_date_recommended_versions = "31/12/2099";
	}

// populating data : end_date_resorption_versions
myStringList_edrv.addAll(Arrays.asList(row4.end_date_resorption_versions.split(",")));

// populating data : end_date_supported_versions
myStringList_edsv.addAll(Arrays.asList(row4.end_date_supported_versions.split(",")));

// populating data : end_date_recommended_versions
myStringList_edrev.addAll(Arrays.asList(row4.end_date_recommended_versions.split(",")));

	// For =&amp;gt; end_date_resorption_versions
for (String ListOfDateString : myStringList_edrv) {
			dates.add(sdf.parse(ListOfDateString));
	}
	// For end_date_supported_versions
for (String ListOfDateString_edsv : myStringList_edsv) {
			dates_edsv.add(sdf.parse(ListOfDateString_edsv));
	}
	// For end_date_recommended_versions
for (String ListOfDateString_edrev : myStringList_edrev) {
			dates_edrev.add(sdf.parse(ListOfDateString_edrev));
			}
	&lt;/PRE&gt; 
&lt;P&gt;End Code&lt;/P&gt; 
&lt;PRE&gt;// Output row

// getDate min end_date_resorption_versions
	Date minDate = Collections.min(dates);
	String strDate = sdf.format(minDate);
        System.out.println(" getDate min end_date_resorption_versions : "+strDate);	
	
// getDate min end_date_supported_versions
	Date minDate_edsv = Collections.min(dates_edsv);
	String strDate_edsv = sdf.format(minDate_edsv);
       System.out.println(" getDate min end_date_supported_versions : "+strDate_edsv);
	
// getDate min end_date_recommended_versions
	Date minDate_edrev = Collections.min(dates_edrev);
	String strDate_edrev = sdf.format(minDate_edrev);
        System.out.println(" getDate min end_date_recommended_versions : "+strDate_edrev);	
// 

row6.end_date_resorption_versions 	= strDate;
row6.end_date_supported_versions	= strDate_edsv;
row6.end_date_recommended_versions	= strDate_edrev;
System.out.println(" THE END " );&lt;/PRE&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;And When I run the job, here's the result.&lt;/P&gt; 
&lt;P&gt;I get what I want when I put "System.out.println", but my output is like my input...&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tjavaFlex_output.png" style="width: 932px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009Ma88.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/128073iDCD603CD9AFF2893/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009Ma88.png" alt="0683p000009Ma88.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;at the limit if I had the same values in the columns, I could use a tAggregateRow to have only a single row&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;where i'm wrong ?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Regards&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 02:24:41 GMT</pubDate>
    <dc:creator>raoh</dc:creator>
    <dc:date>2024-11-16T02:24:41Z</dc:date>
    <item>
      <title>TjavaFlex output issue</title>
      <link>https://community.qlik.com/t5/Talend-Studio/TjavaFlex-output-issue/m-p/2260247#M41435</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Below you can see the result of a query, with list of date in string&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;.-----------+------------+-----------------------------------------------------------------+----------------------------+-----------------------------.
|                                                                            tLogRow_2                                                                |
|=----------+------------+-----------------------------------------------------------------+----------------------------+----------------------------=|
|editorName |ProductName |end_date_resorption_versions                                     |end_date_supported_versions |end_date_recommended_versions|
|=----------+------------+-----------------------------------------------------------------+----------------------------+----------------------------=|
|EditorA    |PN_A	 |31/03/2017,31/03/2017,31/03/2017,31/03/2017,31/03/2017,31/03/2017|null                        |null                         |
|EditorA    |PN_A	 |30/06/2024                                                       |null                        |30/06/2024                   |
|EditorA    |PN_A	 |30/11/2020,30/06/2017                                            |null                        |null                         |
|EditorA    |PN_A	 |null                                                             |30/06/2024                  |null                         |
|EditorA    |PN_A        |null                                                             |null                        |null                         |
|EditorA    |PN_A	 |30/11/2020,30/11/2020                                            |null                        |null                         |
|EditorB    |PN_B	 |18/05/2017,31/03/2017,31/01/20                                   |null                        |null                         |
|EditorB    |PN_B	 |03/06/2024                                                       |01/02/2020                  |30/06/2024                   |
|EditorB    |PN_B	 |23/12/2014			                                   |null                        |null                         |
|EditorB    |PN_B	 |null                                                             |01/02/2020                  |30/06/2020                   |
|EditorB    |PN_B	 |null                                                             |null                        |null                         |
|EditorB    |PN_B	 |12/12/2012,31/12/2020                                            |null                        |13/01/2020                   |
'-----------+------------------------+-----------------------------------------------------+----------------------------+-----------------------------'&lt;/PRE&gt; 
&lt;P&gt;Here's the result I want to get :&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;.-----------+------------------------+-----------------------------------------------------------------+-------------.
|                                                                            tLogRow_10                               |
|=----------+------------------------+-----------------------------------------------------------------+-------------=|
|editorName |ProductName  |end_date_resorption_versions   |end_date_supported_versions |end_date_recommended_versions|
|=----------+-------------+-------------------------------+----------------------------+----------------------------=|
|EditorA    |PN_A	  |31/03/2017		          |30/06/2024		       |30/06/2024 		     |
|EditorB    |PN_B         |31/01/2012                     |01/02/2020		       |13/01/2020 		     |
'-----------+-------------+-------------------------------+----------------------------+-----------------------------'&lt;/PRE&gt; 
&lt;P&gt;I want for each column find the min date.&lt;/P&gt; 
&lt;P&gt;12 rows in input -&amp;gt; 2 rows in outputs&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;My approach is this:&lt;BR /&gt;First, by column, I store all the values in an array&lt;BR /&gt;In a second step, I convert the dates which are in STRING to DATE.&lt;BR /&gt;In a third step, I retrieve for each column the date min.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tjavaFlex_jobDesign.png" style="width: 520px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009Ma83.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/144037iB73334BEA140A30C/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009Ma83.png" alt="0683p000009Ma83.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;So i to try to get the result i wanted : i used tJavaFlex&lt;/P&gt; 
&lt;P&gt;Start code :&lt;/P&gt; 
&lt;PRE&gt;SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");

// Array for end_date_resorption_versions
List&amp;lt;String&amp;gt; myStringList_edrv = new ArrayList&amp;lt;&amp;gt;();
List&amp;lt;Date&amp;gt; dates = new ArrayList&amp;lt;&amp;gt;();

// Array for end_date_supported_versions
List&amp;lt;String&amp;gt; myStringList_edsv = new ArrayList&amp;lt;&amp;gt;();
List&amp;lt;Date&amp;gt; dates_edsv = new ArrayList&amp;lt;&amp;gt;();

// Array for end_date_recommended_versions
List&amp;lt;String&amp;gt; myStringList_edrev = new ArrayList&amp;lt;&amp;gt;();
List&amp;lt;Date&amp;gt; dates_edrev = new ArrayList&amp;lt;&amp;gt;();&lt;/PRE&gt; 
&lt;P&gt;Main code&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;if (row4.end_date_resorption_versions == null ){
		row4.end_date_resorption_versions  = "31/12/2099";
	}
if (row4.end_date_supported_versions == null ){		
		row4.end_date_supported_versions   = "31/12/2099";
	}
if (row4.end_date_recommended_versions == null) {
		row4.end_date_recommended_versions = "31/12/2099";
	}

// populating data : end_date_resorption_versions
myStringList_edrv.addAll(Arrays.asList(row4.end_date_resorption_versions.split(",")));

// populating data : end_date_supported_versions
myStringList_edsv.addAll(Arrays.asList(row4.end_date_supported_versions.split(",")));

// populating data : end_date_recommended_versions
myStringList_edrev.addAll(Arrays.asList(row4.end_date_recommended_versions.split(",")));

	// For =&amp;gt; end_date_resorption_versions
for (String ListOfDateString : myStringList_edrv) {
			dates.add(sdf.parse(ListOfDateString));
	}
	// For end_date_supported_versions
for (String ListOfDateString_edsv : myStringList_edsv) {
			dates_edsv.add(sdf.parse(ListOfDateString_edsv));
	}
	// For end_date_recommended_versions
for (String ListOfDateString_edrev : myStringList_edrev) {
			dates_edrev.add(sdf.parse(ListOfDateString_edrev));
			}
	&lt;/PRE&gt; 
&lt;P&gt;End Code&lt;/P&gt; 
&lt;PRE&gt;// Output row

// getDate min end_date_resorption_versions
	Date minDate = Collections.min(dates);
	String strDate = sdf.format(minDate);
        System.out.println(" getDate min end_date_resorption_versions : "+strDate);	
	
// getDate min end_date_supported_versions
	Date minDate_edsv = Collections.min(dates_edsv);
	String strDate_edsv = sdf.format(minDate_edsv);
       System.out.println(" getDate min end_date_supported_versions : "+strDate_edsv);
	
// getDate min end_date_recommended_versions
	Date minDate_edrev = Collections.min(dates_edrev);
	String strDate_edrev = sdf.format(minDate_edrev);
        System.out.println(" getDate min end_date_recommended_versions : "+strDate_edrev);	
// 

row6.end_date_resorption_versions 	= strDate;
row6.end_date_supported_versions	= strDate_edsv;
row6.end_date_recommended_versions	= strDate_edrev;
System.out.println(" THE END " );&lt;/PRE&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;And When I run the job, here's the result.&lt;/P&gt; 
&lt;P&gt;I get what I want when I put "System.out.println", but my output is like my input...&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tjavaFlex_output.png" style="width: 932px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009Ma88.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/128073iDCD603CD9AFF2893/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009Ma88.png" alt="0683p000009Ma88.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;at the limit if I had the same values in the columns, I could use a tAggregateRow to have only a single row&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;where i'm wrong ?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Regards&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 02:24:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/TjavaFlex-output-issue/m-p/2260247#M41435</guid>
      <dc:creator>raoh</dc:creator>
      <dc:date>2024-11-16T02:24:41Z</dc:date>
    </item>
  </channel>
</rss>

