<?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] tMap Expression Builder - multiple else if in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-tMap-Expression-Builder-multiple-else-if/m-p/2277995#M53589</link>
    <description>Hi&lt;BR /&gt;The convenientest way is to create a custom routine(a java method) in Talend Studio.&lt;BR /&gt;Regards,&lt;BR /&gt;Pedro</description>
    <pubDate>Wed, 25 Jul 2012 02:52:08 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-07-25T02:52:08Z</dc:date>
    <item>
      <title>[resolved] tMap Expression Builder - multiple else if</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-tMap-Expression-Builder-multiple-else-if/m-p/2277994#M53588</link>
      <description>Hi all, 
&lt;BR /&gt;I have a simple project with a tFileInputDelimited, tMap, and tMysqlOutput components. I'm trying to build a calculated field in the tMap component Expression builder, but all my attempts have failed to compile at this point. What I'm doing is fairly straight forward, in php it would look something like this: 
&lt;BR /&gt; 
&lt;PRE&gt;if ($custPrice&amp;gt;0) {&lt;BR /&gt;                        // sale&lt;BR /&gt;                        if ($promoCode=='GP') {&lt;BR /&gt;                                $revenueType='G';&lt;BR /&gt;                        } else {&lt;BR /&gt;                                $revenueType='S';&lt;BR /&gt;                        }&lt;BR /&gt;                } else if ($custPrice&amp;lt;0) {&lt;BR /&gt;                        // return/refund&lt;BR /&gt;                        $revenueType='R';&lt;BR /&gt;                } else {&lt;BR /&gt;                        // no charge&lt;BR /&gt;                        if ($promoCode=='GR') {&lt;BR /&gt;                                $revenueType='D';&lt;BR /&gt;                        } else if ($productTypeIdentifier=='7' || $productTypeIdentifier=='7T' || $productTypeIdentifier=='7F') {&lt;BR /&gt;                                // upgrade&lt;BR /&gt;                                $revenueType='U';&lt;BR /&gt;                        } else if ($productTypeIdentifier=='1' || $productTypeIdentifier=='1T' || $productTypeIdentifier=='1F') {&lt;BR /&gt;                                // comp&lt;BR /&gt;                                $revenueType='C';&lt;BR /&gt;                        } else  {&lt;BR /&gt;                                // other! not expected&lt;BR /&gt;                                $revenueType='O';&lt;BR /&gt;                        }&lt;BR /&gt;                }&lt;/PRE&gt; 
&lt;BR /&gt;Basically the revenueType G, S, R, U or C is what I want to return to the output column. I seem to be able to do individual row1.column.equals lines properly - Is it possible to do in one expression in Talend? Or a better way to handle this? 
&lt;BR /&gt;Thanks!</description>
      <pubDate>Tue, 24 Jul 2012 21:23:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-tMap-Expression-Builder-multiple-else-if/m-p/2277994#M53588</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-24T21:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] tMap Expression Builder - multiple else if</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-tMap-Expression-Builder-multiple-else-if/m-p/2277995#M53589</link>
      <description>Hi&lt;BR /&gt;The convenientest way is to create a custom routine(a java method) in Talend Studio.&lt;BR /&gt;Regards,&lt;BR /&gt;Pedro</description>
      <pubDate>Wed, 25 Jul 2012 02:52:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-tMap-Expression-Builder-multiple-else-if/m-p/2277995#M53589</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-25T02:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] tMap Expression Builder - multiple else if</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-tMap-Expression-Builder-multiple-else-if/m-p/2277996#M53590</link>
      <description>Simply 
&lt;PRE&gt;row1.custPrice&amp;gt;0&lt;BR /&gt;?row1.promoCode.equals("GP")&lt;BR /&gt; ?"G"&lt;BR /&gt; :"S"&lt;BR /&gt;:row1.custPrice&amp;lt;0&lt;BR /&gt; ?"R"&lt;BR /&gt; :row1.promoCode.equals("GR")&lt;BR /&gt;  ?"D"&lt;BR /&gt;  :row1.productTypeIdentifier.matches("7|7T|7F")&lt;BR /&gt;   ?"U"&lt;BR /&gt;   :row1.productTypeIdentifier.matches("1|1T|1F")&lt;BR /&gt;    ?"C"&lt;BR /&gt;    :"O"&lt;/PRE&gt; 
&lt;BR /&gt;The whitespace is irrelevant but included for ease of reading. I've used a regex .matches comparison rather than multiple .equals comparison for simplicity.</description>
      <pubDate>Wed, 25 Jul 2012 03:29:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-tMap-Expression-Builder-multiple-else-if/m-p/2277996#M53590</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2012-07-25T03:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] tMap Expression Builder - multiple else if</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-tMap-Expression-Builder-multiple-else-if/m-p/2277997#M53591</link>
      <description>alevy - thanks so much - that did the trick!</description>
      <pubDate>Wed, 25 Jul 2012 21:20:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-tMap-Expression-Builder-multiple-else-if/m-p/2277997#M53591</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-25T21:20:34Z</dc:date>
    </item>
  </channel>
</rss>

