<?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 Output values from tJava and input it in trigger &amp;quot;Run if&amp;quot; in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Output-values-from-tJava-and-input-it-in-trigger-quot-Run-if/m-p/2324847#M94508</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;I would like to execute one action or another depending on the result of a tJava component.&lt;BR /&gt;If the job runs before 15:00, the trigger (if_10_15) will be executed.&lt;BR /&gt;If the job is executed after 15:00, it will be the trigger (if_15_18) that will be executed.&lt;BR /&gt;I do not know how to do this. I put an exit in each of my conditions of my tJava (row1.etat) and connected it via a trigger "Run if" containing the conditions if (row1.etat == -1), if (row1.etat == 0) and if (row1.etat == 1).&lt;BR /&gt;But I have some errors.&lt;BR /&gt;If anyone could show me the right way, it would be nice.&lt;BR /&gt;Thank you in advance.&lt;/P&gt; 
&lt;P&gt;&lt;BR /&gt;My tJava code :&lt;/P&gt; 
&lt;PRE&gt;SimpleDateFormat dateformat = new SimpleDateFormat("hh:mm"); 
Date hLim = dateformat.parse("15:00"); 
String pattern = "HH:mm"; 
Date hNow = new Date();
int etat = TalendDate.compareDate(hNow, hLim, pattern);

// Faire passer la valeur de etat en argument au "Trigger Run if" 
if (etat == -1){
	System.out.println(etat + " / " + hNow + " / " + " Tournée demain matin");
	row1.etat = etat;
} 
if (etat == 0){
	System.out.println(etat + " / " + hNow + " / " + " Tournée demain matin");
	row1.etat = etat;
} 
else if (etat == 1){
	System.out.println(etat + " / " + hNow + " / " + " Tournée demain après-midi");
	row1.etat = etat;
}&lt;/PRE&gt; 
&lt;P&gt;My job structure :&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JobListesTourneesBaches.JPG" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M6Au.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/128876i35A42B02A466CFEB/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M6Au.jpg" alt="0683p000009M6Au.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 05:21:08 GMT</pubDate>
    <dc:creator>gadje1</dc:creator>
    <dc:date>2024-11-16T05:21:08Z</dc:date>
    <item>
      <title>Output values from tJava and input it in trigger "Run if"</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Output-values-from-tJava-and-input-it-in-trigger-quot-Run-if/m-p/2324847#M94508</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;I would like to execute one action or another depending on the result of a tJava component.&lt;BR /&gt;If the job runs before 15:00, the trigger (if_10_15) will be executed.&lt;BR /&gt;If the job is executed after 15:00, it will be the trigger (if_15_18) that will be executed.&lt;BR /&gt;I do not know how to do this. I put an exit in each of my conditions of my tJava (row1.etat) and connected it via a trigger "Run if" containing the conditions if (row1.etat == -1), if (row1.etat == 0) and if (row1.etat == 1).&lt;BR /&gt;But I have some errors.&lt;BR /&gt;If anyone could show me the right way, it would be nice.&lt;BR /&gt;Thank you in advance.&lt;/P&gt; 
&lt;P&gt;&lt;BR /&gt;My tJava code :&lt;/P&gt; 
&lt;PRE&gt;SimpleDateFormat dateformat = new SimpleDateFormat("hh:mm"); 
Date hLim = dateformat.parse("15:00"); 
String pattern = "HH:mm"; 
Date hNow = new Date();
int etat = TalendDate.compareDate(hNow, hLim, pattern);

// Faire passer la valeur de etat en argument au "Trigger Run if" 
if (etat == -1){
	System.out.println(etat + " / " + hNow + " / " + " Tournée demain matin");
	row1.etat = etat;
} 
if (etat == 0){
	System.out.println(etat + " / " + hNow + " / " + " Tournée demain matin");
	row1.etat = etat;
} 
else if (etat == 1){
	System.out.println(etat + " / " + hNow + " / " + " Tournée demain après-midi");
	row1.etat = etat;
}&lt;/PRE&gt; 
&lt;P&gt;My job structure :&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JobListesTourneesBaches.JPG" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M6Au.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/128876i35A42B02A466CFEB/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M6Au.jpg" alt="0683p000009M6Au.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 05:21:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Output-values-from-tJava-and-input-it-in-trigger-quot-Run-if/m-p/2324847#M94508</guid>
      <dc:creator>gadje1</dc:creator>
      <dc:date>2024-11-16T05:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Output values from tJava and input it in trigger "Run if"</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Output-values-from-tJava-and-input-it-in-trigger-quot-Run-if/m-p/2324848#M94509</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;What's the error are you getting when you use tJava custom code in your job?&lt;/P&gt;
&lt;P&gt;Here is a component tWaitForFile which iterates on a directory and triggers the next component when the defined condition is met.&lt;/P&gt;
&lt;P&gt;&lt;A title="https://help.talend.com/reader/HP30FGhc6Q9LiHefZVu4yw/xygPn~ESNbYiVEUQlhIr9A" href="https://help.talend.com/reader/HP30FGhc6Q9LiHefZVu4yw/xygPn~ESNbYiVEUQlhIr9A" target="_self" rel="nofollow noopener noreferrer"&gt;https://help.talend.com/reader/HP30FGhc6Q9LiHefZVu4yw/xygPn~ESNbYiVEUQlhIr9A&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;
&lt;P&gt;Sabrina&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2019 07:44:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Output-values-from-tJava-and-input-it-in-trigger-quot-Run-if/m-p/2324848#M94509</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-05T07:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: Output values from tJava and input it in trigger "Run if"</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Output-values-from-tJava-and-input-it-in-trigger-quot-Run-if/m-p/2324849#M94510</link>
      <description>Hi,
&lt;BR /&gt;Variable defined in tJava has a scope in the Run-If connection.
&lt;BR /&gt;I would do:
&lt;BR /&gt;boolean runMorningTour = TalendDate.compareDate(hNow, hLim, pattern) &amp;lt;= 0;
&lt;BR /&gt;Then if the runif, respectively, runMorningTour and !runMorningTour
&lt;BR /&gt;
&lt;BR /&gt;Cheers,
&lt;BR /&gt;Navds</description>
      <pubDate>Mon, 05 Aug 2019 13:45:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Output-values-from-tJava-and-input-it-in-trigger-quot-Run-if/m-p/2324849#M94510</guid>
      <dc:creator>navds</dc:creator>
      <dc:date>2019-08-05T13:45:14Z</dc:date>
    </item>
  </channel>
</rss>

