<?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 Unable to evaluate interval field in IF statement in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Unable-to-evaluate-interval-field-in-IF-statement/m-p/310119#M114502</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=if( num(interval&lt;/P&gt;&lt;P&gt;(frac&lt;/P&gt;&lt;P&gt;&amp;nbsp; (timestamp&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; (&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; timestamp# (EventDate, 'DD-MMM-YYYY hh:mm:ss'),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'DD/MM/YYYY hh:mm:ss'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp; ), 'hh'&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) &amp;lt; 7, 'AM', 'PM')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Jun 2011 10:21:54 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-06-22T10:21:54Z</dc:date>
    <item>
      <title>Unable to evaluate interval field in IF statement</title>
      <link>https://community.qlik.com/t5/QlikView/Unable-to-evaluate-interval-field-in-IF-statement/m-p/310118#M114501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;﻿Hi,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope that somebody could help me solve the following problem please.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created a QlikView variable that evaluates an expression in order to extract the hour from a date field - having got the hour, if it is less that 7 then return 'AM', otherwise return 'PM' (the final calculation is a bit more involved than this but this demonstrates the problem).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: in the variable expression below, the field EventDate is a date time, for example, 21-Jun-2011 06:59:59.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following variable expression correctly returns the hour element from the timestamp as a string (E.g. 21-Jun-2011 06:59:59 returns '06'):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;=interval&lt;BR /&gt;(frac&lt;BR /&gt;&amp;nbsp; (timestamp&lt;BR /&gt;&amp;nbsp;&amp;nbsp; (&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; timestamp# (EventDate, 'DD-MMM-YYYY hh:mm:ss'),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'DD/MM/YYYY hh:mm:ss'&lt;BR /&gt;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;&amp;nbsp; ), 'hh'&lt;BR /&gt;) &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;﻿&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I add an if statement, the expression always evaluates true whatever the hour number (i.e. returns 'AM'):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;=if( (interval&lt;BR /&gt;(frac&lt;BR /&gt;&amp;nbsp; (timestamp&lt;BR /&gt;&amp;nbsp;&amp;nbsp; (&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; timestamp# (EventDate, 'DD-MMM-YYYY hh:mm:ss'),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'DD/MM/YYYY hh:mm:ss'&lt;BR /&gt;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;&amp;nbsp; ), 'hh'&lt;BR /&gt;)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) &amp;lt; '07', 'AM', 'PM')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems that the problem would be solved if I convert the interval hour value to an integer but am not sure how to do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have attached the QlikView document that demonstrates the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks.&lt;/P&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jun 2011 10:01:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Unable-to-evaluate-interval-field-in-IF-statement/m-p/310118#M114501</guid>
      <dc:creator />
      <dc:date>2011-06-22T10:01:09Z</dc:date>
    </item>
    <item>
      <title>Unable to evaluate interval field in IF statement</title>
      <link>https://community.qlik.com/t5/QlikView/Unable-to-evaluate-interval-field-in-IF-statement/m-p/310119#M114502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=if( num(interval&lt;/P&gt;&lt;P&gt;(frac&lt;/P&gt;&lt;P&gt;&amp;nbsp; (timestamp&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; (&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; timestamp# (EventDate, 'DD-MMM-YYYY hh:mm:ss'),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'DD/MM/YYYY hh:mm:ss'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp; ), 'hh'&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) &amp;lt; 7, 'AM', 'PM')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jun 2011 10:21:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Unable-to-evaluate-interval-field-in-IF-statement/m-p/310119#M114502</guid>
      <dc:creator />
      <dc:date>2011-06-22T10:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to evaluate interval field in IF statement</title>
      <link>https://community.qlik.com/t5/QlikView/Unable-to-evaluate-interval-field-in-IF-statement/m-p/310120#M114503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Have a look at the example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I tried to achieve in different manner.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Hope this will help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kaushik Solanki &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jun 2011 10:39:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Unable-to-evaluate-interval-field-in-IF-statement/m-p/310120#M114503</guid>
      <dc:creator>kaushiknsolanki</dc:creator>
      <dc:date>2011-06-22T10:39:10Z</dc:date>
    </item>
    <item>
      <title>Unable to evaluate interval field in IF statement</title>
      <link>https://community.qlik.com/t5/QlikView/Unable-to-evaluate-interval-field-in-IF-statement/m-p/310121#M114504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are using single quate '7'. Instead use only 7, as you are comparing numeric value.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jun 2011 11:46:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Unable-to-evaluate-interval-field-in-IF-statement/m-p/310121#M114504</guid>
      <dc:creator />
      <dc:date>2011-06-22T11:46:40Z</dc:date>
    </item>
  </channel>
</rss>

