<?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 to use a string as a function/expression? = indirect (excel) and eval (matlab) in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-use-a-string-as-a-function-expression-indirect-excel-and/m-p/365020#M494730</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to set a variable (FC) either to be a factor ("*1.3") or a summand ("+0.3"). This variable shall then be used as a function on the field "price":&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;eval('price'&amp;amp;FC)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Matlab this would work. or in excel it would be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;indirect('price'&amp;amp;FC)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But how can I do this in QlikView?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Joans&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Mar 2012 14:04:24 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-03-22T14:04:24Z</dc:date>
    <item>
      <title>How to use a string as a function/expression? = indirect (excel) and eval (matlab)</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-a-string-as-a-function-expression-indirect-excel-and/m-p/365020#M494730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to set a variable (FC) either to be a factor ("*1.3") or a summand ("+0.3"). This variable shall then be used as a function on the field "price":&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;eval('price'&amp;amp;FC)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Matlab this would work. or in excel it would be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;indirect('price'&amp;amp;FC)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But how can I do this in QlikView?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Joans&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Mar 2012 14:04:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-a-string-as-a-function-expression-indirect-excel-and/m-p/365020#M494730</guid>
      <dc:creator />
      <dc:date>2012-03-22T14:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a string as a function/expression? = indirect (excel) and eval (matlab)</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-a-string-as-a-function-expression-indirect-excel-and/m-p/365021#M494731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Apparently the evaluate function in QlikView only works at the script level.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the script as an example I did:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table1:&lt;/P&gt;&lt;P&gt;LOAD * INLINE&lt;/P&gt;&lt;P&gt;[&lt;/P&gt;&lt;P&gt;Price&lt;/P&gt;&lt;P&gt;100&lt;/P&gt;&lt;P&gt;200&lt;/P&gt;&lt;P&gt;300&lt;/P&gt;&lt;P&gt;400&lt;/P&gt;&lt;P&gt;500&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set FC = "*1.3";&lt;/P&gt;&lt;P&gt;set FC2 = "+0.3";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table2:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;Evaluate(Price $(FC)) as FCPriceCalculated,&lt;/P&gt;&lt;P&gt;Evaluate(Price $(FC2)) as FC2PriceCalculated&lt;/P&gt;&lt;P&gt;Resident Table1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop table Table1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This calculates based on your variables into the new fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you try and use evaluate at the expression level or in a variable it will not work... &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have attached a working qvw for your reference as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Mar 2012 18:12:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-a-string-as-a-function-expression-indirect-excel-and/m-p/365021#M494731</guid>
      <dc:creator />
      <dc:date>2012-03-22T18:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a string as a function/expression? = indirect (excel) and eval (matlab)</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-a-string-as-a-function-expression-indirect-excel-and/m-p/365022#M494732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Bapperson! Looks good, but as you metnion, the variable is used in an expression and is dynamically alteredd by the user, so the scripted solution won't work. :-S&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My way around the problem:&lt;/P&gt;&lt;P&gt;I just defined two variables: FC_factor and FC_summand, so that I defined the expression as&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;price*FC_factor+FC_summand&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Although this did not solve the original question it provided a solution by circumventing the problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Mar 2012 19:53:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-a-string-as-a-function-expression-indirect-excel-and/m-p/365022#M494732</guid>
      <dc:creator />
      <dc:date>2012-03-22T19:53:41Z</dc:date>
    </item>
  </channel>
</rss>

