<?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 How do I get evaluate() to work? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-do-I-get-evaluate-to-work/m-p/236588#M87753</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree it's worth reporting as a bug.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 May 2011 23:43:35 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2011-05-13T23:43:35Z</dc:date>
    <item>
      <title>How do I get evaluate() to work?</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-I-get-evaluate-to-work/m-p/236581#M87746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I'm trying to get evaluate() to work for me in a QlikView 10 script, but it will only return me NULL!&lt;/P&gt;&lt;P&gt;Ultimately, I'm trying to load a glossary from a spreadsheet with two columns (Term, Definition), and want Definition text to be allowed to be expressions (including variable references )that are evaluated at Load time. This is my script, with a couple of extra fields, test1 and test2, I've added in my attempts to get evaluate() to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;Definitions:&lt;BR /&gt;LOAD&lt;BR /&gt; Term,&lt;BR /&gt; if(isnull(evaluate(Definition)),Definition,evaluate(Definition)) AS Definition,&lt;BR /&gt;&lt;BR /&gt; // a couple of attempts to get meaningful results from evaluate()&lt;BR /&gt; evaluate(5*8) as test1, // this is the evaluate() example in the QV10 Reference Manual - though it seems to be an incorrect example to me, since the parameter is meant to be a string.&lt;BR /&gt; evaluate('5*8') as test2&lt;BR /&gt;FROM&lt;BR /&gt;[Definitions.xls]&lt;BR /&gt;(biff, embedded labels, table is Definitions$);&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;The resulting table, though, has NULLs for every record in the Definition, test1 and test2 columns.&lt;/P&gt;&lt;P&gt;Am I not understanding something, or is evaluate() broken?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Angus.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 May 2011 04:12:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-I-get-evaluate-to-work/m-p/236581#M87746</guid>
      <dc:creator>gussfish</dc:creator>
      <dc:date>2011-05-02T04:12:11Z</dc:date>
    </item>
    <item>
      <title>How do I get evaluate() to work?</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-I-get-evaluate-to-work/m-p/236582#M87747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Both&lt;/P&gt;&lt;P&gt;evaluate(5*8) as test1&lt;BR /&gt; and&lt;BR /&gt;evaluate('5*8') as test2&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;work for me. QV10 SR2. Can't test the complete script because I don't have the Definitions.xls file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 May 2011 04:36:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-I-get-evaluate-to-work/m-p/236582#M87747</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2011-05-02T04:36:01Z</dc:date>
    </item>
    <item>
      <title>How do I get evaluate() to work?</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-I-get-evaluate-to-work/m-p/236583#M87748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;thanks for your response. I'll begin by saying I'm running QV 10 SP1 on my developer boc, which is actually ahead of what's on our production servers; consequently, I'm loathe to get even further ahead of the pack by upgrading to SP2.&lt;/P&gt;&lt;P&gt;So, tt seems to me that evaluate() is a rather flakey when it comes to BIFF files. Here's what I've found&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Both evaluate(5*8) and evaluate('5*8'), when expressed directly in the script, per the script below, correctly return 40, BUT ONLY on the records for which RawDefinition is numeric-like i.e. 5*9, '5*9' or "5*9". Why on earth it should depend on that field entirely escapes me. This is true whether the MyFile data is loaded from inline or BIFF (both are show under later dot points).&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;Definitions:&lt;BR /&gt;LOAD&lt;BR /&gt; Source As Defs.Source,&lt;BR /&gt; Term AS Defs.Term,&lt;BR /&gt; RawDefinition AS Defs.RawDefinition,&lt;BR /&gt; evaluate(RawDefinition) AS EvaluatedDefinition,&lt;BR /&gt; evaluate(5*8) As FortyFiveA, // This is fine&lt;BR /&gt; evaluate('5*8') As FortyFiveB // This is fine&lt;BR /&gt;resident MyFile;&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;UL&gt;&lt;LI&gt;evaluate(inlinefield) correctly returns 40 when inlinefield contains either the string 5*8 or the string '5*8', as per when the code snippet above is preceded by the code after the next dot point.&lt;/LI&gt;&lt;LI&gt;evaluate(inlinefield) correctly incorporates variables when evaluating inlinefield values containing a dollar-expansion expression, even when the variable contains a string. However, I'm pretty sure this is because the variables are substituted at the time the LOAD * inline ... statement execute.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;SET vBeginningOfHistory=1 Oct 2010;&lt;BR /&gt;SET vLover=Romeo;&lt;BR /&gt;SET vEndOfHistory=13 Mar 2194; // Never know! &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;SET vBeloved=Juliet;&lt;BR /&gt;MyFile:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt; Source,Term, RawDefinition&lt;BR /&gt; Inline,FortyFiveFromFileA, 5*8 // This is fine&lt;BR /&gt; Inline,FortyFiveFromFileB, '5*8' // This is fine&lt;BR /&gt; Inline,AsYouLikeIt, All the world's a stage // This is fine.&lt;BR /&gt; Inline,BeginningOfHistory, My world began $(vBeginningOfHistory) // This is fine.&lt;BR /&gt; Inline,EndOfHistory, The world could end $(vEndOfHistory) // This is fine.&lt;BR /&gt; Inline,StarCrossedLover, $(vLover) // This is fine.&lt;BR /&gt; Inline,StarCrossedBeloved, $(vBeloved) // This is fine.&lt;BR /&gt; ];&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;UL&gt;&lt;LI&gt;evaluate(bifffield) only works when the bifffield is both unquoted and non-numeric in value. If it is quoted AND is a numeric expression, then the dequoted expression is returned. Otherwise, NULL. This is seen with replacing the above LOAD * INLINE statement with this:&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;MyFile:&lt;BR /&gt;LOAD&lt;BR /&gt; 'XLS' AS Source,&lt;BR /&gt; Term,&lt;BR /&gt; RawDefinition&lt;BR /&gt;from&lt;BR /&gt; [Test.xls] (biff, embedded labels, table is Sheet1$);&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;and using this as the Test.xls!Sheet1 content:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" style="height:193px;" width="344"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;B&gt;Term&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;B&gt;RawDefinition&lt;/B&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;FortyFiveFromFileA&lt;/TD&gt;&lt;TD&gt;5*8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;FortyFiveFromFileB&lt;/TD&gt;&lt;TD&gt;'5*8'&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;FortyFiveFromFileC&lt;/TD&gt;&lt;TD&gt;"5*8"&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;AsYouLikeIt&lt;/TD&gt;&lt;TD&gt;All the world's a stage&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;BeginningOfHistory&lt;/TD&gt;&lt;TD&gt;My world began $(vBeginningOfHistory)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;EndOfHistory&lt;/TD&gt;&lt;TD&gt;The world could end $(vEndOfHistory)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;StarCrossedLover&lt;/TD&gt;&lt;TD&gt;'$(vLover)'&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;StarCrossedBeloved&lt;/TD&gt;&lt;TD&gt;$(vBeloved)&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Of these, evaluate() for FortyFiveFromFileA returned 40, evaluate() for FortyFiveFromFileA returned 5*8 (no quotes), and NULL for all others.&lt;/P&gt;&lt;P&gt;You might ask, are the respective expressions from the two sources (Inline &amp;amp; BIFF) truly the same? As far as I can tell, yes. My test of this was to let QlikView concatenate both into the one table (MyFile) and express that table in the GUI with a Table Box. But now it got even wierder! After reloading, the Inline table's expressions 5*8 and '5*8' were now evaluat()ing to null(), while the respective BIFF entries were still 40 and 5*8 respectively! And just to be sure, I trim()ed the strings before evaluat()ing. Further, the values themselves seem identical, inasmuchas when I click on, say, '5*8' in the list, QlikView then displays a '5*8' record from both the XLS and the Inline data - yet the result of evaluate() for each differs!&lt;/P&gt;&lt;P&gt;So, this evaluate() function is yet a mysterious beasty insofar as BIFF OR Inline value processing is concerned, and I don't feel I can trust it unless someone can provide a logical reason for its behaviour.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 May 2011 07:30:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-I-get-evaluate-to-work/m-p/236583#M87748</guid>
      <dc:creator>gussfish</dc:creator>
      <dc:date>2011-05-02T07:30:08Z</dc:date>
    </item>
    <item>
      <title>How do I get evaluate() to work?</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-I-get-evaluate-to-work/m-p/236584#M87749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rob,&lt;/P&gt;&lt;P&gt;I've been able to trim one aspect of this down to a simple test case. Would you give it a try &amp;amp; tell me what you think?&lt;/P&gt;&lt;P&gt;Here's the script, including all the usual default script variables, for completeness:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;SET ThousandSep=',';&lt;BR /&gt;SET DecimalSep='.';&lt;BR /&gt;SET MoneyThousandSep=',';&lt;BR /&gt;SET MoneyDecimalSep='.';&lt;BR /&gt;SET MoneyFormat='$#,##0.00;-$#,##0.00';&lt;BR /&gt;SET TimeFormat='h:mm:ss TT';&lt;BR /&gt;SET DateFormat='DD MMM YYYY';&lt;BR /&gt;SET TimestampFormat='YYYY-MM-DD h:mm:ss[.fff] TT';&lt;BR /&gt;SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';&lt;BR /&gt;SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';&lt;BR /&gt;&lt;BR /&gt;RawData:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt; InlineName, InlineValue&lt;BR /&gt; FortyInlineRecord, 5*8&lt;BR /&gt; TextInlineRecord, random text&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;Evaluations:&lt;BR /&gt;LOAD&lt;BR /&gt; InlineName AS Name,&lt;BR /&gt; evaluate(InlineValue) AS EvaluatedInlineValue,&lt;BR /&gt; evaluate('5*8') As AlwaysFortyColumn&lt;BR /&gt;resident RawData;&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;My expectation is that AlwaysFortyColumn will contain a value of 40 for every record in Evaluations, without fail. In reality, when I inspect Evaluations using a Table Box displaying the three fields, I'm finding that AlwaysFortyColumn is null for Name=TextInlineRecord (though it is 40 for Name=FortyInlineRecord).&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Angus.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 May 2011 11:03:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-I-get-evaluate-to-work/m-p/236584#M87749</guid>
      <dc:creator>gussfish</dc:creator>
      <dc:date>2011-05-02T11:03:45Z</dc:date>
    </item>
    <item>
      <title>How do I get evaluate() to work?</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-I-get-evaluate-to-work/m-p/236585#M87750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try This:&lt;/P&gt;&lt;P&gt;Evaluations:&lt;BR /&gt; LOAD InlineName AS Name,&lt;BR /&gt; evaluate('5*8') As AlwaysFortyColumn&lt;BR /&gt; resident RawData;&lt;BR /&gt;&lt;BR /&gt;Join(Evaluations)&lt;BR /&gt; LOAD InlineName AS Name,&lt;BR /&gt; evaluate(InlineValue) AS EvaluatedInlineValue&lt;BR /&gt; resident RawData;&lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 May 2011 13:44:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-I-get-evaluate-to-work/m-p/236585#M87750</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-05-02T13:44:58Z</dc:date>
    </item>
    <item>
      <title>How do I get evaluate() to work?</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-I-get-evaluate-to-work/m-p/236586#M87751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Angus,&lt;/P&gt;&lt;P&gt;I think I can tell you what's happening. When an evaluate() fails, the remainder of LOAD statement in no executed for that row, So when you try to evaluate(random text) that fails, and subsequent fields never get filled. You can prove this by rearraging the order of the fields in the LOAD.&lt;/P&gt;&lt;P&gt;I'm not sure what the best workaround would be. Best case is to never try to evaluate bad expressions &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 May 2011 20:00:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-I-get-evaluate-to-work/m-p/236586#M87751</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2011-05-02T20:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get evaluate() to work?</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-I-get-evaluate-to-work/m-p/236587#M87752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This smells like a QlikView defect to me, especially since the documented behaviour of evaluate() is that it should merely return NULL if the expression is not valid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What do you think?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 May 2011 00:09:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-I-get-evaluate-to-work/m-p/236587#M87752</guid>
      <dc:creator>gussfish</dc:creator>
      <dc:date>2011-05-13T00:09:40Z</dc:date>
    </item>
    <item>
      <title>How do I get evaluate() to work?</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-I-get-evaluate-to-work/m-p/236588#M87753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree it's worth reporting as a bug.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 May 2011 23:43:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-I-get-evaluate-to-work/m-p/236588#M87753</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2011-05-13T23:43:35Z</dc:date>
    </item>
    <item>
      <title>How do I get evaluate() to work?</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-I-get-evaluate-to-work/m-p/236589#M87754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Done.&amp;nbsp; Thanks for your support.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Angus.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 May 2011 01:16:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-I-get-evaluate-to-work/m-p/236589#M87754</guid>
      <dc:creator>gussfish</dc:creator>
      <dc:date>2011-05-16T01:16:08Z</dc:date>
    </item>
  </channel>
</rss>

