<?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 issue with an If statement in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Script-issue-with-an-If-statement/m-p/1082715#M17991</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Both Floor did the trick.&amp;nbsp; I will have to read up on that a bit more&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Jan 2016 09:49:24 GMT</pubDate>
    <dc:creator />
    <dc:date>2016-01-14T09:49:24Z</dc:date>
    <item>
      <title>Script issue with an If statement</title>
      <link>https://community.qlik.com/t5/App-Development/Script-issue-with-an-If-statement/m-p/1082712#M17988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;During the load process I'm assessing if a change in record occurs at the end of the month and if it does not force it to be the end of the previous month in a new column End Date Alt.&lt;/P&gt;&lt;P&gt;I've attempted to do this using an if statement.&amp;nbsp; I've added an extra column "Check" to assess why I'm having a problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Data]:&lt;/P&gt;&lt;P&gt;Load *&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; , if(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; date([End Date],'DD/MM/YYYY') = MonthEnd(date([End Date],'DD/MM/YYYY'))&lt;/P&gt;&lt;P&gt;&amp;nbsp; , date([End Date],'DD/MM/YYYY')&lt;/P&gt;&lt;P&gt;&amp;nbsp; , MonthEnd(addmonths([End Date],-1))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) as [End Date Alt]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; , MonthEnd([End Date]) as Check;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load&amp;nbsp; * Inline [&lt;/P&gt;&lt;P&gt;'End Date' &lt;/P&gt;&lt;P&gt;31/10/2016,&lt;/P&gt;&lt;P&gt;04/10/2016,&lt;/P&gt;&lt;P&gt;29/02/2016&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The if statement is not assessing the dates as I would have expected and I'm stumped.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The End Date matches the Check column for both the 29th and the 31st and yet the If statement does not resolve that way.&amp;nbsp; Clearly I'm doing something wrong.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#575757&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;NaN&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;transparent&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;,&amp;quot;verticalAlign&amp;quot;:&amp;quot;baseline&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;}" style="width: 315px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="color: rgb(255, 255, 255); text-align: center; padding: 2px; background-color: rgb(102, 144, 188);"&gt;End Date&lt;/TH&gt;&lt;TH style="color: rgb(255, 255, 255); text-align: center; padding: 2px; background-color: rgb(102, 144, 188);"&gt;End Date Alt&lt;/TH&gt;&lt;TH style="color: rgb(255, 255, 255); text-align: center; padding: 2px; background-color: rgb(102, 144, 188);"&gt;Check&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl64" height="20" style="color: rgb(87, 87, 87); text-align: center; font-family: arial, helvetica, sans-serif; vertical-align: baseline; background-color: rgba(0, 0, 0, 0);"&gt;29/02/2016&lt;/TD&gt;&lt;TD align="right" class="xl64" style="color: rgb(87, 87, 87); text-align: center; font-family: arial, helvetica, sans-serif; vertical-align: baseline; background-color: rgba(0, 0, 0, 0);"&gt;31/01/2016&lt;/TD&gt;&lt;TD align="right" class="xl64" style="color: rgb(87, 87, 87); text-align: center; font-family: arial, helvetica, sans-serif; vertical-align: baseline; background-color: rgba(0, 0, 0, 0);"&gt;29/02/2016&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl64" height="20" style="color: rgb(87, 87, 87); text-align: center; font-family: arial, helvetica, sans-serif; vertical-align: baseline; background-color: rgba(0, 0, 0, 0);"&gt;04/10/2016&lt;/TD&gt;&lt;TD align="right" class="xl64" style="color: rgb(87, 87, 87); text-align: center; font-family: arial, helvetica, sans-serif; vertical-align: baseline; background-color: rgba(0, 0, 0, 0);"&gt;30/09/2016&lt;/TD&gt;&lt;TD align="right" class="xl64" style="color: rgb(87, 87, 87); text-align: center; font-family: arial, helvetica, sans-serif; vertical-align: baseline; background-color: rgba(0, 0, 0, 0);"&gt;31/10/2016&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl64" height="20" style="color: rgb(87, 87, 87); text-align: center; font-family: arial, helvetica, sans-serif; vertical-align: baseline; background-color: rgba(0, 0, 0, 0);"&gt;31/10/2016&lt;/TD&gt;&lt;TD align="right" class="xl64" style="color: rgb(87, 87, 87); text-align: center; font-family: arial, helvetica, sans-serif; vertical-align: baseline; background-color: rgba(0, 0, 0, 0);"&gt;30/09/2016&lt;/TD&gt;&lt;TD align="right" class="xl64" style="color: rgb(87, 87, 87); text-align: center; font-family: arial, helvetica, sans-serif; vertical-align: baseline; background-color: rgba(0, 0, 0, 0);"&gt;31/10/2016&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jan 2016 16:51:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Script-issue-with-an-If-statement/m-p/1082712#M17988</guid>
      <dc:creator />
      <dc:date>2016-01-13T16:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: Script issue with an If statement</title>
      <link>https://community.qlik.com/t5/App-Development/Script-issue-with-an-If-statement/m-p/1082713#M17989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;MonthEnd() function outputs a TimeStamp, I think you will need to use Floor() with it to give a desired output here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;[Data]:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Load *&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; , if(&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; date([End Date],'DD/MM/YYYY') = Floor(MonthEnd(date([End Date],'DD/MM/YYYY')))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; , date([End Date],'DD/MM/YYYY')&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; , MonthEnd(addmonths([End Date],-1))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) as [End Date Alt]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; , MonthEnd([End Date]) as Check;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Load&amp;nbsp; * Inline [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;'End Date'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;31/10/2016,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;04/10/2016,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;29/02/2016&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jan 2016 17:35:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Script-issue-with-an-If-statement/m-p/1082713#M17989</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-01-13T17:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Script issue with an If statement</title>
      <link>https://community.qlik.com/t5/App-Development/Script-issue-with-an-If-statement/m-p/1082714#M17990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P class="syntax"&gt;&lt;A name="kanchor511"&gt;&lt;/A&gt;&lt;A name="MonthEnd"&gt;&lt;/A&gt;&lt;SPAN class="Bold"&gt;MonthEnd(&lt;/SPAN&gt;&lt;SPAN class="Italic"&gt;date [, shift = 0]&lt;/SPAN&gt;&lt;SPAN class="Bold"&gt;)&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Returns a value corresponding to a timestamp with the last millisecond of the last date of the month containing &lt;SPAN class="Italic"&gt;date&lt;/SPAN&gt;.&lt;/STRONG&gt; The default output format will be the DateFormat set in the script. &lt;SPAN class="Italic"&gt;Shift&lt;/SPAN&gt; is an integer, where the value 0 indicates the month which contains &lt;SPAN class="Italic"&gt;date&lt;/SPAN&gt;. Negative values in &lt;SPAN class="Italic"&gt;shift&lt;/SPAN&gt; indicate preceding months and positive values indicate succeeding months. &lt;/P&gt;&lt;P class="example"&gt;Examples:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;monthend ( '2001-02-19' )&lt;/SPAN&gt; returns '2001-02-28' with an &lt;STRONG&gt;underlying numeric value corresponding to '2001-02-28 23:59:59.999'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;monthend ( '2001-02-19', -1 )&lt;/SPAN&gt; returns '2001-01-31' with an underlying numeric value corresponding to '2001-01-31 23:59:59.999'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you need to compare to &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if(&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Floor([End Date]) = Floor(MonthEnd( [End Date])),&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;....&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;[Date() formatting is not needed in numerical comparisons]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jan 2016 17:36:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Script-issue-with-an-If-statement/m-p/1082714#M17990</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-01-13T17:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Script issue with an If statement</title>
      <link>https://community.qlik.com/t5/App-Development/Script-issue-with-an-If-statement/m-p/1082715#M17991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Both Floor did the trick.&amp;nbsp; I will have to read up on that a bit more&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2016 09:49:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Script-issue-with-an-If-statement/m-p/1082715#M17991</guid>
      <dc:creator />
      <dc:date>2016-01-14T09:49:24Z</dc:date>
    </item>
  </channel>
</rss>

