<?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: Script If, Else Error? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Script-If-Else-Error/m-p/332562#M703799</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, I want the last day of the month that exists only.&amp;nbsp; I thought the code I used above would give me that for most cases, but it gives me all 3 days values if it exists for all 3 days.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I want is the value on the last day of the month it exists.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Jul 2012 21:22:12 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-07-03T21:22:12Z</dc:date>
    <item>
      <title>Script If, Else Error?</title>
      <link>https://community.qlik.com/t5/QlikView/Script-If-Else-Error/m-p/332559#M703796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi community,&lt;/P&gt;&lt;P&gt;I think I have a bug in the script.&amp;nbsp; If not please correct me.&amp;nbsp; I'm making a field of if(StatementA,FieldA,if(StatementB,FieldA,if(StatementC,FieldA))) as FieldB, I thought that this was how to do if/else in the script, but I found that for each of the ifs that are true FieldA is stored as a value for FieldB.&amp;nbsp; What am I missing, is there a way to rewrite this to get what I want which is exclusive if/else?&amp;nbsp; An example from my code is below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(match(date(Date),date(monthend(Date))),[Adj Close],if(match(date(Date),date(monthend(Date)-1)),[Adj Close],if(match(date(Date),date(monthend(Date)-2)),[Adj Close]))) as Close2,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2012 20:35:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-If-Else-Error/m-p/332559#M703796</guid>
      <dc:creator />
      <dc:date>2012-07-03T20:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: Script If, Else Error?</title>
      <link>https://community.qlik.com/t5/QlikView/Script-If-Else-Error/m-p/332560#M703797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would write monthend out of date function: monthend(date(Date)) &lt;/P&gt;&lt;P&gt;and I would use monthend(addmonths(date(Date),-1))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #eef4f9;"&gt;if(match(date(Date),date(monthend(Date))),[Adj Close],if(match(date(Date),date(monthend(Date)-1)),[Adj Close],if(match(date(Date),date(monthend(Date)-2)),[Adj Close]))) as Close2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #eef4f9;"&gt;I haven´t tried but I hope this helps. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #eef4f9;"&gt;The if clause seems fine&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2012 20:49:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-If-Else-Error/m-p/332560#M703797</guid>
      <dc:creator>chematos</dc:creator>
      <dc:date>2012-07-03T20:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Script If, Else Error?</title>
      <link>https://community.qlik.com/t5/QlikView/Script-If-Else-Error/m-p/332561#M703798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seems to me that you want to add the field &lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #eef4f9;"&gt;[Adj Close] &lt;/SPAN&gt; if it is the last 3 days of the month, rtight? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;why don´t you simplify your if:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (&amp;nbsp; &lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #eef4f9;"&gt;date(Date)&lt;/SPAN&gt; &amp;gt;= (&lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #eef4f9;"&gt;date(monthend(Date)&lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #eef4f9;"&gt;-2&lt;/SPAN&gt;)) , &lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #eef4f9;"&gt;[Adj Close] &lt;/SPAN&gt;) )&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2012 21:00:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-If-Else-Error/m-p/332561#M703798</guid>
      <dc:creator />
      <dc:date>2012-07-03T21:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: Script If, Else Error?</title>
      <link>https://community.qlik.com/t5/QlikView/Script-If-Else-Error/m-p/332562#M703799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, I want the last day of the month that exists only.&amp;nbsp; I thought the code I used above would give me that for most cases, but it gives me all 3 days values if it exists for all 3 days.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I want is the value on the last day of the month it exists.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2012 21:22:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-If-Else-Error/m-p/332562#M703799</guid>
      <dc:creator />
      <dc:date>2012-07-03T21:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Script If, Else Error?</title>
      <link>https://community.qlik.com/t5/QlikView/Script-If-Else-Error/m-p/332563#M703800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have already done something like it when loading (something like it):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// gets the last month&lt;/P&gt;&lt;P&gt;TEMP:&lt;/P&gt;&lt;P&gt;LOAD max(MT_MES) as maxcod&lt;/P&gt;&lt;P&gt;RESIDENT META;&lt;/P&gt;&lt;P&gt;LET vMaxMes =  peek('maxcod');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// gets the last date of each month&lt;/P&gt;&lt;P&gt;drop table TEMP;&lt;/P&gt;&lt;P&gt;FOR i = 1 TO $(vMaxMes)&lt;/P&gt;&lt;P&gt;LAST_DATES:&lt;/P&gt;&lt;P&gt;LOAD $(i) AS COD_MONTH_TEMP,&lt;/P&gt;&lt;P&gt; max(date) as last_day&lt;/P&gt;&lt;P&gt;RESIDENT table;&lt;/P&gt;&lt;P&gt;NEXT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// gets the values on the last dates of each month&lt;/P&gt;&lt;P&gt;LAST_VALUES:&lt;/P&gt;&lt;P&gt;LOAD COD_MONTH_TEMP AS COD_MONTH&lt;/P&gt;&lt;P&gt;FROM LAST_DATES as DAY;&lt;/P&gt;&lt;P&gt;join&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;COD_MONTH, DAY, VALUE&lt;/P&gt;&lt;P&gt;resident table;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Esta mensagem (incluíndo qualquer anexo) é dirigida apenas para o uso do indivíduo ou da entidade a qual está endereçada e pode conter informações privadas, proprietárias, privilegiadas, confidenciais que podem servir como evidências sob as leis aplicáveis ou em processos judiciais.&lt;/P&gt;&lt;P&gt;Caso você não seja o destinatário pretendido, você está aqui notificado que qualquer uso, disseminação, distribuição, ou cópia dessa comunicação é estritamente proibida. Se você recebeu essa comunicação por engano, notifique-nos imediatamente por telefone, e &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/info.png" /&gt; destrua essa mensagem se estiver impressa ou (ii) exclua imediatamente essa mensagem se esta for uma comunicação eletrônica.&lt;/P&gt;&lt;P&gt;Obrigado.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This message (including any attachments) is intended only for the use of the individual or entity to which it is addressed and may contain information that is non-public, proprietary, privileged, confidential, and exempt from disclosure under applicable law or may constitute as attorney work product.&lt;/P&gt;&lt;P&gt;If you are not the intended recipient, you are hereby notified that any use, dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, notify us immediately by telephone and &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/info.png" /&gt; destroy this message if this is printed or (ii) delete this message immediately if this is an electronic communication.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2012 21:34:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-If-Else-Error/m-p/332563#M703800</guid>
      <dc:creator />
      <dc:date>2012-07-03T21:34:18Z</dc:date>
    </item>
  </channel>
</rss>

