<?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 Making new field with loop in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Making-new-field-with-loop/m-p/1580506#M740241</link>
    <description>&lt;P&gt;Hi guys. I'm trying to make a new field in load script and need to automate the process. Basically I have a table of people's names and their dates of birth (Year). I would like to make a new field (Century) based on (Year). Sounds easy, but...&lt;/P&gt;&lt;P&gt;All I have done so far is:&lt;/P&gt;&lt;P&gt;FOR counter=0 to 20&lt;BR /&gt;Table_name:&lt;BR /&gt;LOAD&lt;BR /&gt;FullName,&lt;BR /&gt;if(&lt;BR /&gt;BirthYear&amp;gt;($(counter)*100) and BirthYear&amp;lt;($(counter)*100+100),&lt;BR /&gt;$(counter)+1&lt;BR /&gt;)&lt;BR /&gt;as Century&lt;BR /&gt;Resident Table1;&lt;BR /&gt;NEXT&lt;/P&gt;&lt;P&gt;And as the result I have a huge table (20 times bigger than needed) with a lot of null data. Can anybody just give a clue how is it possible to manage such a task? Many thanks.&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 20:51:48 GMT</pubDate>
    <dc:creator>Leo2</dc:creator>
    <dc:date>2024-11-16T20:51:48Z</dc:date>
    <item>
      <title>Making new field with loop</title>
      <link>https://community.qlik.com/t5/QlikView/Making-new-field-with-loop/m-p/1580506#M740241</link>
      <description>&lt;P&gt;Hi guys. I'm trying to make a new field in load script and need to automate the process. Basically I have a table of people's names and their dates of birth (Year). I would like to make a new field (Century) based on (Year). Sounds easy, but...&lt;/P&gt;&lt;P&gt;All I have done so far is:&lt;/P&gt;&lt;P&gt;FOR counter=0 to 20&lt;BR /&gt;Table_name:&lt;BR /&gt;LOAD&lt;BR /&gt;FullName,&lt;BR /&gt;if(&lt;BR /&gt;BirthYear&amp;gt;($(counter)*100) and BirthYear&amp;lt;($(counter)*100+100),&lt;BR /&gt;$(counter)+1&lt;BR /&gt;)&lt;BR /&gt;as Century&lt;BR /&gt;Resident Table1;&lt;BR /&gt;NEXT&lt;/P&gt;&lt;P&gt;And as the result I have a huge table (20 times bigger than needed) with a lot of null data. Can anybody just give a clue how is it possible to manage such a task? Many thanks.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 20:51:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Making-new-field-with-loop/m-p/1580506#M740241</guid>
      <dc:creator>Leo2</dc:creator>
      <dc:date>2024-11-16T20:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: Making new field with loop</title>
      <link>https://community.qlik.com/t5/QlikView/Making-new-field-with-loop/m-p/1580518#M740242</link>
      <description>Why do you need a loop for calculating the century. Why not a simple extra column like below&lt;BR /&gt;&lt;BR /&gt;if(Mod(BirthYear,100)=0,BirthYear/100,floor(BirthYear/100)+1) as Century&lt;BR /&gt;&lt;BR /&gt;that logic will give 20 for 1998 and 2000,21 for 2001&lt;BR /&gt;&lt;BR /&gt;Maybe i misunderstood the problem</description>
      <pubDate>Wed, 15 May 2019 14:51:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Making-new-field-with-loop/m-p/1580518#M740242</guid>
      <dc:creator>dplr-rn</dc:creator>
      <dc:date>2019-05-15T14:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: Making new field with loop</title>
      <link>https://community.qlik.com/t5/QlikView/Making-new-field-with-loop/m-p/1580798#M740243</link>
      <description>&lt;P&gt;Thanks for the hint. I've just corrected the formula to work good with both + and - dates. Here it is:&lt;/P&gt;&lt;P&gt;if(&lt;BR /&gt;birth_year&amp;gt;0,&lt;BR /&gt;FLOOR(birth_year/100) +1,&lt;BR /&gt;FLOOR(birth_year/100)&lt;BR /&gt;)&lt;BR /&gt;AS Century,&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 06:49:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Making-new-field-with-loop/m-p/1580798#M740243</guid>
      <dc:creator>Leo2</dc:creator>
      <dc:date>2019-05-16T06:49:23Z</dc:date>
    </item>
  </channel>
</rss>

