<?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: Block of statement in tmap expression editior in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Block-of-statement-in-tmap-expression-editior/m-p/2249724#M34176</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;A somewhat unusual way of doing things in tMap but you can write a block of code like that:&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LurL.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/151227iDA729B820A6E47D4/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LurL.png" alt="0683p000009LurL.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Var.var1 is used to get the next value for sequence "s1".&lt;/P&gt; 
&lt;P&gt;Var.var2 value is forced to 1 (or any other value) for syntax. Be careful to the semicolumn after the 1 (usually there is no).&lt;/P&gt; 
&lt;P&gt;The 2nd line of code is here to reset the&amp;nbsp;&lt;SPAN&gt;sequence "s1" to 0 if the curent value is even.&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;And the result is what you expect (I've added 2 lines just for testing):&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 671px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LurV.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/155463iF1AB3DAC5EBEF2A2/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LurV.png" alt="0683p000009LurV.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
    <pubDate>Sat, 03 Jun 2017 23:44:27 GMT</pubDate>
    <dc:creator>TRF</dc:creator>
    <dc:date>2017-06-03T23:44:27Z</dc:date>
    <item>
      <title>Block of statement in tmap expression editior</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Block-of-statement-in-tmap-expression-editior/m-p/2249723#M34175</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;How to write a block of statement in tmap expression editor. I don't want to use extra component just because of some 2 extra statement.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;e,g , I am having 10 input records(record_no, id, name) and after each two record add some value to column and reset the record count, so for next two it will start will 1.&lt;/P&gt; 
&lt;P&gt;Input&lt;/P&gt; 
&lt;P&gt;id|name&lt;/P&gt; 
&lt;P&gt;1|abc&lt;/P&gt; 
&lt;P&gt;2|pqr&lt;/P&gt; 
&lt;P&gt;3|xyz&lt;/P&gt; 
&lt;P&gt;4|ccc&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;output&lt;/P&gt; 
&lt;P&gt;id|name|rec_num&lt;/P&gt; 
&lt;P&gt;1|abc|1&lt;/P&gt; 
&lt;P&gt;2|pqr|2&lt;/P&gt; 
&lt;P&gt;3|xyz|1&lt;/P&gt; 
&lt;P&gt;4|ccc|2&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;rec_number = if(Numeric.sequence("s1",1,1) % 2&amp;nbsp;!=0) {&amp;nbsp;Numeric.sequence("s1",1,1) &amp;nbsp;}&lt;/P&gt; 
&lt;P&gt;else {&lt;/P&gt; 
&lt;P&gt;2 --&amp;gt; Assign 2 to 2nd row ;&lt;/P&gt; 
&lt;P&gt;Numeric.resetSequence("s1",1)--&amp;gt; Reset the sequence to 1 &amp;nbsp;&lt;/P&gt; 
&lt;P&gt;}&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;For other assignment I am already using tmap but I have implement above logic too. How I can implement only using tmap.&lt;/P&gt; 
&lt;P&gt;I can achieve by using tjavarow, but one component I have to add which I don't want to add.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jun 2017 22:54:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Block-of-statement-in-tmap-expression-editior/m-p/2249723#M34175</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-06-03T22:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: Block of statement in tmap expression editior</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Block-of-statement-in-tmap-expression-editior/m-p/2249724#M34176</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;A somewhat unusual way of doing things in tMap but you can write a block of code like that:&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LurL.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/151227iDA729B820A6E47D4/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LurL.png" alt="0683p000009LurL.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Var.var1 is used to get the next value for sequence "s1".&lt;/P&gt; 
&lt;P&gt;Var.var2 value is forced to 1 (or any other value) for syntax. Be careful to the semicolumn after the 1 (usually there is no).&lt;/P&gt; 
&lt;P&gt;The 2nd line of code is here to reset the&amp;nbsp;&lt;SPAN&gt;sequence "s1" to 0 if the curent value is even.&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;And the result is what you expect (I've added 2 lines just for testing):&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 671px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LurV.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/155463iF1AB3DAC5EBEF2A2/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LurV.png" alt="0683p000009LurV.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jun 2017 23:44:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Block-of-statement-in-tmap-expression-editior/m-p/2249724#M34176</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2017-06-03T23:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: Block of statement in tmap expression editior</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Block-of-statement-in-tmap-expression-editior/m-p/2249725#M34177</link>
      <description>I feel compelled to point out that using a sequence to fill in 1 or 2 is wasteful. If the previous value is 1, current value is 2, otherwise 1.</description>
      <pubDate>Sun, 04 Jun 2017 04:02:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Block-of-statement-in-tmap-expression-editior/m-p/2249725#M34177</guid>
      <dc:creator>cterenzi</dc:creator>
      <dc:date>2017-06-04T04:02:38Z</dc:date>
    </item>
  </channel>
</rss>

