<?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 Error in a variable formula in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Error-in-a-variable-formula/m-p/223971#M76431</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there, what I suggest is creating a text object and just put a expression like:&lt;/P&gt;&lt;P&gt;=vProfit&lt;/P&gt;&lt;P&gt;to see if your macro is working, if it is, probably you have null values in Income of cost, you can try:&lt;/P&gt;&lt;P&gt;rangesum(Income, Profit, -Cost)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Apr 2010 18:58:57 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-04-23T18:58:57Z</dc:date>
    <item>
      <title>Error in a variable formula</title>
      <link>https://community.qlik.com/t5/QlikView/Error-in-a-variable-formula/m-p/223970#M76430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone, I have this problem. I have a simple table with 4 expressions (columns). Two of them are simple sums("Cost" ; "Income"), the third one ("Profit") is a variable (vProfit) which takes the value from a specific cell of another simple table using this macro:&lt;/P&gt;&lt;P&gt;&lt;PRE&gt;Sub vProfit&lt;/PRE&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;Dim&lt;/B&gt; v ,c,d, f,h&lt;/P&gt;&lt;P&gt;&lt;B&gt;set&lt;/B&gt; IB=ActiveDocument.GetSheetObject("CH08")&lt;/P&gt;&lt;P&gt;v=IB.GetCell(1,7).text&lt;/P&gt;&lt;P&gt;&lt;B&gt;set&lt;/B&gt; c = ActiveDocument.Variables("vProfit")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;c.SetContent v,&lt;/B&gt;&lt;B&gt;true&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;Activedocument.GetApplication.Refresh&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;End Sub&lt;/B&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The four one should be the result of this formula &lt;STRONG&gt;Incomes + vProfit - Cost&lt;/STRONG&gt;. but I can´t make it work.&lt;/P&gt;&lt;P&gt;The first three values change everytime I select a different year or month in two List Box, but the four expression (Result) always shows a "-", a null value.&lt;/P&gt;&lt;P&gt;I've tried to make the expression "Result" with this formula &lt;PRE&gt; Income+vProfit-Cost&lt;/PRE&gt; and with this one &lt;PRE&gt; Income+Profit-Cost&lt;/PRE&gt; but the cell "Result" remains the same, blank.&lt;/P&gt;&lt;P&gt;Anyone has an idea.&lt;/P&gt;&lt;P&gt;Thanks in advance, an good weekend.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Apr 2010 16:49:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Error-in-a-variable-formula/m-p/223970#M76430</guid>
      <dc:creator />
      <dc:date>2010-04-23T16:49:57Z</dc:date>
    </item>
    <item>
      <title>Error in a variable formula</title>
      <link>https://community.qlik.com/t5/QlikView/Error-in-a-variable-formula/m-p/223971#M76431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there, what I suggest is creating a text object and just put a expression like:&lt;/P&gt;&lt;P&gt;=vProfit&lt;/P&gt;&lt;P&gt;to see if your macro is working, if it is, probably you have null values in Income of cost, you can try:&lt;/P&gt;&lt;P&gt;rangesum(Income, Profit, -Cost)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Apr 2010 18:58:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Error-in-a-variable-formula/m-p/223971#M76431</guid>
      <dc:creator />
      <dc:date>2010-04-23T18:58:57Z</dc:date>
    </item>
    <item>
      <title>Error in a variable formula</title>
      <link>https://community.qlik.com/t5/QlikView/Error-in-a-variable-formula/m-p/223972#M76432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ivan, thanks for you reply. The macro works but I can't get teh final result. I've tried several options&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;rangesum(Income, Profit,-Cost)&lt;BR /&gt;rangesum(Income, -Cost) + Profit&lt;BR /&gt;Using the variable VProfit instead of the expression Profit&lt;BR /&gt;rangesum(Income, vProfit,-Cost)&lt;BR /&gt;rangesum(Income, -Cost) + vProfit&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I think the problem lies on the variable vProit itself. Because I'tried the following formula to check if tthe variable is correct and the expression Result gives a null value.&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;=vProfit * 2&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;A href="http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Discussions.Components.Files/11/7840.Captura.JPG"&gt;&lt;IMG alt="" border="0" src="http://community.qlik.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Discussions.Components.Files/11/7840.Captura.JPG" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Discussions.Components.Files/11/4213.Captura2.JPG"&gt;&lt;IMG alt="" border="0" src="http://community.qlik.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Discussions.Components.Files/11/4213.Captura2.JPG" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When It takes the value Profit using the macro, the macro does the following code&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;&lt;B&gt;set&lt;/B&gt; IB=ActiveDocument.GetSheetObject("CH08")&lt;BR /&gt;v=IB.GetCell(1,7).text&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Maybe the problem is the GETCELL.text, because it takes the value as a text. What you think?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Apr 2010 09:26:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Error-in-a-variable-formula/m-p/223972#M76432</guid>
      <dc:creator />
      <dc:date>2010-04-26T09:26:02Z</dc:date>
    </item>
  </channel>
</rss>

