<?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: Replace Nesting Ifs in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Replace-Nesting-Ifs/m-p/1420472#M612442</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;can you provide all kind of date formate of 'Completion Week' and the Year they belong to?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Oct 2017 09:04:23 GMT</pubDate>
    <dc:creator>woshua5550</dc:creator>
    <dc:date>2017-10-24T09:04:23Z</dc:date>
    <item>
      <title>Replace Nesting Ifs</title>
      <link>https://community.qlik.com/t5/QlikView/Replace-Nesting-Ifs/m-p/1420471#M612441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello to all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a field that has dates in different formats, called "Completion Week".&lt;/P&gt;&lt;P&gt;From that field, I want to make another field called "Year", where it just shows the year of the date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the "problematic" format, is the one that shows the date in weeks without expressing the year, for example: 1022-1028.&lt;/P&gt;&lt;P&gt;The weeks always go from Sunday to Saturday. So in this case, the year is 2017.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The rule that I made in the following lines, checks if the first part of that string ('&lt;SPAN style="font-size: 13.3333px;"&gt;1022', in the previous case) corresponds to a Sunday in the current year. If it isn't, check the same for 2016. If it isn't, checks the same for 2015, and so on, until finding a year where this condition is reached, and assigns that Year for that week.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;The code works fine, but the problem is that I find it too long and not proper. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="ZZZZZZZZZZZZCaptuWre.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/180687_ZZZZZZZZZZZZCaptuWre.PNG" style="height: 227px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to know if there's a more efficient way to carry out this script. Some piece of code with less lines, so that is more efficient and proper.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate any piece of advice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Oct 2017 08:44:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Replace-Nesting-Ifs/m-p/1420471#M612441</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-24T08:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: Replace Nesting Ifs</title>
      <link>https://community.qlik.com/t5/QlikView/Replace-Nesting-Ifs/m-p/1420472#M612442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;can you provide all kind of date formate of 'Completion Week' and the Year they belong to?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Oct 2017 09:04:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Replace-Nesting-Ifs/m-p/1420472#M612442</guid>
      <dc:creator>woshua5550</dc:creator>
      <dc:date>2017-10-24T09:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: Replace Nesting Ifs</title>
      <link>https://community.qlik.com/t5/QlikView/Replace-Nesting-Ifs/m-p/1420473#M612443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The field &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;'Completion Week', has values like these ones.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="222"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="18" width="222"&gt;0221-0227&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="18"&gt;0228-0305&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="18"&gt;0306-0312&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="18"&gt;0312-0318&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="18"&gt;0313-0319&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="18"&gt;0320-0326&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="18"&gt;0326-0301&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="18"&gt;0326-0401&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="18"&gt;0327-0402&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="18"&gt;0403-0409&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="18"&gt;0409-0415&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="18"&gt;0410-0416&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="18"&gt;0416-0422&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;I would like to assign the Year for each week, knowing that the first part of the string before the "-", is a Sunday (MMDD).&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Please ignore the first line of the nested ifs in the image I posted before. That condition is for another thing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Oct 2017 10:05:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Replace-Nesting-Ifs/m-p/1420473#M612443</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-24T10:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Replace Nesting Ifs</title>
      <link>https://community.qlik.com/t5/QlikView/Replace-Nesting-Ifs/m-p/1420474#M612444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;is this better ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For i = 2017 to 2009 step -1&lt;/P&gt;&lt;P&gt;LOAD * Where Year &amp;lt;&amp;gt; Null() and Not Exists([Completion Week]);&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;[Completion Week],&lt;/P&gt;&lt;P&gt;IF(WeekDay(MakeDate($(i),Left([Completion Week],2),Right(Left([Completion Week],4),2)))='Sun',$(i)) as Year&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Inline [&lt;/P&gt;&lt;P&gt;Completion Week&lt;/P&gt;&lt;P&gt;0221-0227&lt;/P&gt;&lt;P&gt;0228-0305&lt;/P&gt;&lt;P&gt;0306-0312&lt;/P&gt;&lt;P&gt;0312-0318&lt;/P&gt;&lt;P&gt;0313-0319&lt;/P&gt;&lt;P&gt;0320-0326&lt;/P&gt;&lt;P&gt;0326-0301&lt;/P&gt;&lt;P&gt;0326-0401&lt;/P&gt;&lt;P&gt;0327-0402&lt;/P&gt;&lt;P&gt;0403-0409&lt;/P&gt;&lt;P&gt;0409-0415&lt;/P&gt;&lt;P&gt;0410-0416&lt;/P&gt;&lt;P&gt;0416-0422&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Oct 2017 10:31:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Replace-Nesting-Ifs/m-p/1420474#M612444</guid>
      <dc:creator>woshua5550</dc:creator>
      <dc:date>2017-10-24T10:31:38Z</dc:date>
    </item>
  </channel>
</rss>

