<?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 Re: [resolved] If Condition Then Update Else Insert in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363166#M127130</link>
    <description>I prefer this way: 
&lt;BR /&gt;tMap 
&lt;BR /&gt; | 
&lt;BR /&gt; |------- tSugarCRMOutput_forInsert 
&lt;BR /&gt; |------- tSugarCRMOutput_forUpdate 
&lt;BR /&gt;tSugarCRMOutput_forInsert: 
&lt;BR /&gt;1. set action as insert 
&lt;BR /&gt;tSugarCRMOutput_forUpdate: 
&lt;BR /&gt;1. set action as update 
&lt;BR /&gt;In tMap (for example): 
&lt;BR /&gt;1. create a variabile named "operation" 
&lt;BR /&gt;2. calculate the operation and assign the desired value to "operation" variable using if-then-else short version; "I" if you decide to insert current row and "U" if you decide to update (ex. input_row.color=="red"?"I":"U") 
&lt;BR /&gt;3. on every output flow, set the expression filter properly (Var.operation=="I" for tSugarCRMOutput_forInsert......) 
&lt;BR /&gt;bye</description>
    <pubDate>Wed, 18 Jun 2014 14:49:35 GMT</pubDate>
    <dc:creator>gorotman</dc:creator>
    <dc:date>2014-06-18T14:49:35Z</dc:date>
    <item>
      <title>[resolved] If Condition Then Update Else Insert</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363158#M127122</link>
      <description>Hi there, 
&lt;BR /&gt;how can i create a job that makes up this logic: 
&lt;BR /&gt;if condition 
&lt;BR /&gt;then 
&lt;BR /&gt; update 
&lt;BR /&gt;else 
&lt;BR /&gt; insert 
&lt;BR /&gt;condition is a check on a query result (if there is a record) 
&lt;BR /&gt;the query is something like (SELECT id FROM table WHERE date LIKE '....') 
&lt;BR /&gt;My Input is a tSugarCRMInput 
&lt;BR /&gt;My Output are two tSugarCRMOutput 
&lt;BR /&gt;I'm using Talend 5.3.1</description>
      <pubDate>Sat, 21 Sep 2013 14:47:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363158#M127122</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-09-21T14:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] If Condition Then Update Else Insert</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363159#M127123</link>
      <description>Hi 
&lt;BR /&gt;There is a global variable like ((Integer)globalMap.get("tSugarCRMInput_1_NB_LINE")) that counts the numbe of the processed data, you can check if there is at least one record with this global variable, and then use runIf connector to fires different processing. For example: 
&lt;BR /&gt;tSugarCRMInput--main--tJava_1 
&lt;BR /&gt; | 
&lt;BR /&gt;onsubjobok 
&lt;BR /&gt; | 
&lt;BR /&gt;tJava_2--runIf_1---&amp;gt;....tSugarCRMOutput_1( for inserting) 
&lt;BR /&gt; runIf_2 ---&amp;gt;....tSugarCRMOutput_2(for updating) 
&lt;BR /&gt;on tJava_1, it is a output component, do nothing, just let it as empty. 
&lt;BR /&gt;on tJava_2, obbain the total number of processed data, for example: 
&lt;BR /&gt;int nb=((Integer)globalMap.get("tSugarCRMInput_1_NB_LINE")); 
&lt;BR /&gt;if(nb&amp;gt;0){ 
&lt;BR /&gt;globalMap.put("hasData", true); 
&lt;BR /&gt;}else{ 
&lt;BR /&gt;globalMap.put("hasData", false); 
&lt;BR /&gt;} 
&lt;BR /&gt;set the condition of runIf_1 as: 
&lt;BR /&gt;!(Boolean)globalMap.get("hasData") 
&lt;BR /&gt;set the condition of runIf_2 as: 
&lt;BR /&gt;(Boolean)globalMap.get("hasData") 
&lt;BR /&gt;Shong</description>
      <pubDate>Sun, 22 Sep 2013 10:48:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363159#M127123</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-09-22T10:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] If Condition Then Update Else Insert</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363160#M127124</link>
      <description>Hi Shong, 
&lt;BR /&gt;thanks for your answer. 
&lt;BR /&gt;I put in practise your advices. But, how can i connect the tJava_2 component to a SugarCRMOutput one? 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBHF.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/157215iE35E142873CE6C20/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBHF.png" alt="0683p000009MBHF.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Sat, 26 Oct 2013 18:41:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363160#M127124</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-10-26T18:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] If Condition Then Update Else Insert</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363161#M127125</link>
      <description>For the purpose of filter and splice a flow please use the tMap component!
&lt;BR /&gt;Send the input flow to the tMap and create 2 output flows. Set your filter conditions to each flow and connect the flows to an output component dedicated for inserts and the other output flow to an output component dedicated for updates.</description>
      <pubDate>Wed, 30 Oct 2013 19:37:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363161#M127125</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-10-30T19:37:19Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] If Condition Then Update Else Insert</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363162#M127126</link>
      <description>Ok, thanks.&lt;BR /&gt;I succeed and wrote about it here: &lt;A href="http://www.talendforge.org/forum/edit.php?id=120842" rel="nofollow noopener noreferrer"&gt;http://www.talendforge.org/forum/edit.php?id=120842&lt;/A&gt;</description>
      <pubDate>Wed, 30 Oct 2013 20:02:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363162#M127126</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-10-30T20:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] If Condition Then Update Else Insert</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363163#M127127</link>
      <description>Hi, 
&lt;BR /&gt;I have the same problem. I want to insert or update with a condition but i don't understand the @jlolling solution. Please help me</description>
      <pubDate>Fri, 06 Jun 2014 12:20:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363163#M127127</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-06T12:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] If Condition Then Update Else Insert</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363164#M127128</link>
      <description>Hi kfiadjigbe 
&lt;BR /&gt;Please read my previous post, if it does't fit your need, please describe your request with more details. 
&lt;BR /&gt;Shong</description>
      <pubDate>Wed, 11 Jun 2014 02:06:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363164#M127128</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-11T02:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] If Condition Then Update Else Insert</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363165#M127129</link>
      <description>Hi Shong, 
&lt;BR /&gt;Thank you for reply me. My request is how can i create a job that makes up this logic: 
&lt;BR /&gt;- Read one ROW on tfileInputXml and make query to the dataBase to know if the row exist or not. 
&lt;BR /&gt; The query will be something like that ("SELECT * FROM TERRAIN WHERE TERRAIN.EXTERNAL_KEY ='"+ROW.DOSS_REFE_ORIG+"' ) 
&lt;BR /&gt;- If the ROW exist on the database, i will check now (if TERRAIN.LOGICAL_TOUCH = 0) then UPDATE with the ROW which is read in tfileInputXml 
&lt;BR /&gt; else if (TERRAIN.LOGICAL_TOUCH =1) then DO NOTHING 
&lt;BR /&gt;- if the ROW doesn't exist on the database, else insert ROW which is read in tfileInputXml on the dataBase. 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;BR /&gt;So, I have to check every row which is tfileInputXml to know if insert, update or nothing. 
&lt;BR /&gt;My job is like that : 
&lt;BR /&gt; tFileInput2 
&lt;BR /&gt; | 
&lt;BR /&gt; | if (Insert) ??? ------- TERRAIN 
&lt;BR /&gt; tfileInputXml -------- tMap --------- tjavaRow -------- else (Update) ??? ------ TERRAIN 
&lt;BR /&gt; | 
&lt;BR /&gt; | 
&lt;BR /&gt; tOraclerow (query to find something) 
&lt;BR /&gt; | 
&lt;BR /&gt; | 
&lt;BR /&gt; tParseRecordSet 
&lt;BR /&gt; | 
&lt;BR /&gt; | 
&lt;BR /&gt; tJavaRow 
&lt;BR /&gt; 
&lt;BR /&gt;I want to post an image, but I don't know how to do it. Thanks</description>
      <pubDate>Wed, 18 Jun 2014 10:38:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363165#M127129</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-18T10:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] If Condition Then Update Else Insert</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363166#M127130</link>
      <description>I prefer this way: 
&lt;BR /&gt;tMap 
&lt;BR /&gt; | 
&lt;BR /&gt; |------- tSugarCRMOutput_forInsert 
&lt;BR /&gt; |------- tSugarCRMOutput_forUpdate 
&lt;BR /&gt;tSugarCRMOutput_forInsert: 
&lt;BR /&gt;1. set action as insert 
&lt;BR /&gt;tSugarCRMOutput_forUpdate: 
&lt;BR /&gt;1. set action as update 
&lt;BR /&gt;In tMap (for example): 
&lt;BR /&gt;1. create a variabile named "operation" 
&lt;BR /&gt;2. calculate the operation and assign the desired value to "operation" variable using if-then-else short version; "I" if you decide to insert current row and "U" if you decide to update (ex. input_row.color=="red"?"I":"U") 
&lt;BR /&gt;3. on every output flow, set the expression filter properly (Var.operation=="I" for tSugarCRMOutput_forInsert......) 
&lt;BR /&gt;bye</description>
      <pubDate>Wed, 18 Jun 2014 14:49:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363166#M127130</guid>
      <dc:creator>gorotman</dc:creator>
      <dc:date>2014-06-18T14:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] If Condition Then Update Else Insert</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363167#M127131</link>
      <description>Hi, have a look at my example (if content = "Ohio" then insert else update): 
&lt;BR /&gt; 
&lt;A href="http://www.hostingpics.net/viewer.php?id=78891656d.png" target="_blank" rel="nofollow noopener noreferrer"&gt;&lt;IMG src="https://community.qlik.com/" /&gt;&lt;/A&gt; 
&lt;BR /&gt;in your tmap 
&lt;BR /&gt; 
&lt;A href="http://www.hostingpics.net/viewer.php?id=156102Untitled.png" target="_blank" rel="nofollow noopener noreferrer"&gt;&lt;IMG src="https://community.qlik.com/" /&gt;&lt;/A&gt; 
&lt;BR /&gt;Here a tutorial : 
&lt;A href="http://www.talendforge.org/tutorials/tutorial.php?language=english&amp;amp;idTuto=9" rel="nofollow noopener noreferrer"&gt;http://www.talendforge.org/tutorials/tutorial.php?language=english&amp;amp;idTuto=9&lt;/A&gt;</description>
      <pubDate>Wed, 18 Jun 2014 15:21:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363167#M127131</guid>
      <dc:creator>Jcs19</dc:creator>
      <dc:date>2014-06-18T15:21:37Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] If Condition Then Update Else Insert</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363168#M127132</link>
      <description>You 're all the best. Everything is OK for me. Thanks for @Jcs19 and @gorotman</description>
      <pubDate>Thu, 19 Jun 2014 12:07:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-If-Condition-Then-Update-Else-Insert/m-p/2363168#M127132</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-19T12:07:25Z</dc:date>
    </item>
  </channel>
</rss>

