<?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 Using Edit Module Functions in Pivot Table Expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-Edit-Module-Functions-in-Pivot-Table-Expression/m-p/858224#M532828</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I am a newcomer to QlikView and I've ran into a slight problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As part of getting to know the product I have been trying to produce a heat map using a Pivot table and I have been experimenting with ways in which to change the background colour of each cell depending on the value within the cell.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Initially I used the visual queues tab and set the upper an lower limit.&amp;nbsp; This gave me the Green/Yellow/Red but it was not exactly what I was after as I want a gradual shading from Green to yellow, then yellow to red.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So within the Background Color Definition in the Expressions tab of the Pivot Table properties I added the following code to introduce a few more shades.&amp;nbsp; &lt;/P&gt;&lt;P&gt;if(count(StartHour)&amp;lt;500,rgb(00,120,00),&lt;/P&gt;&lt;P&gt;if(count(StartHour)&amp;gt;=500 and Count(StartHour)&amp;lt;1000, rgb(00,150,00),&lt;/P&gt;&lt;P&gt;if(count(StartHour)&amp;gt;=1000 and Count(StartHour)&amp;lt;1500, rgb(00,255,00),&lt;/P&gt;&lt;P&gt;if(count(StartHour)&amp;gt;=1500 and Count(StartHour)&amp;lt;2000, rgb(128,255,00),&lt;/P&gt;&lt;P&gt;if(count(StartHour)&amp;gt;=2000 and Count(StartHour)&amp;lt;3000, rgb(255,255,00),&lt;/P&gt;&lt;P&gt;if(count(StartHour)&amp;gt;=3000 and Count(StartHour)&amp;lt;4000, rgb(255,244,0),&lt;/P&gt;&lt;P&gt;if(Count(StartHour)&amp;gt;=4000 and Count(StartHour)&amp;lt;4500, rgb(255,213,0), &lt;/P&gt;&lt;P&gt;if(Count(StartHour)&amp;gt;=4500 and Count(StartHour)&amp;lt;5500, rgb(255,128,0),&lt;/P&gt;&lt;P&gt;if(Count(StartHour)&amp;gt;=5500 and Count(StartHour)&amp;lt;6500, rgb(255,103,0), rgb(255,0,0)&amp;nbsp; )))))))))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This now looks a bit better but I thought it might be a bit more interesting to create a custom function within the edit module.&amp;nbsp; And here is where my issue lies.&amp;nbsp; I can use these functions from within the script editor when I'm loading data, but I can't use these functions from with any of the expression fields in the pivot table properties.&amp;nbsp; Having tried a few other things like text boxes, I can't get the functions in the edit module to work from any expression field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;This is my Function (VBScript):&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Function GetRedShade (processValue)&lt;/P&gt;&lt;P&gt;REM Return a red shade for the heat map pivot table&lt;/P&gt;&lt;P&gt;DIM redValue&lt;/P&gt;&lt;P&gt;DIM percent, shadeFactor&lt;/P&gt;&lt;P&gt;if processValue &amp;lt; 1500 then&lt;/P&gt;&lt;P&gt;&amp;nbsp; redvalue = "00"&lt;/P&gt;&lt;P&gt;elseif processValue &amp;gt;=1500 and processValue &amp;lt; 2000 then&lt;/P&gt;&lt;P&gt;&amp;nbsp; percent = (processValue/1999)*100&lt;/P&gt;&lt;P&gt;&amp;nbsp; shadeFactor = (255-128)/100&lt;/P&gt;&lt;P&gt;&amp;nbsp; redValue = (percent*shadeFactor)+128&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;&amp;nbsp; redValue = 255&lt;/P&gt;&lt;P&gt;end if&lt;/P&gt;&lt;P&gt;GetRedShade = redValue&lt;/P&gt;&lt;P&gt;end function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So when I call this from the background color definition field like this&lt;/P&gt;&lt;P&gt;rgb(GetRedShade(Count(StartHour)), GetGreenShade(Count(StartHour)), 0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get Error in expression.&amp;nbsp; So can anybody help?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Apr 2015 14:23:04 GMT</pubDate>
    <dc:creator />
    <dc:date>2015-04-30T14:23:04Z</dc:date>
    <item>
      <title>Using Edit Module Functions in Pivot Table Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Edit-Module-Functions-in-Pivot-Table-Expression/m-p/858224#M532828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I am a newcomer to QlikView and I've ran into a slight problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As part of getting to know the product I have been trying to produce a heat map using a Pivot table and I have been experimenting with ways in which to change the background colour of each cell depending on the value within the cell.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Initially I used the visual queues tab and set the upper an lower limit.&amp;nbsp; This gave me the Green/Yellow/Red but it was not exactly what I was after as I want a gradual shading from Green to yellow, then yellow to red.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So within the Background Color Definition in the Expressions tab of the Pivot Table properties I added the following code to introduce a few more shades.&amp;nbsp; &lt;/P&gt;&lt;P&gt;if(count(StartHour)&amp;lt;500,rgb(00,120,00),&lt;/P&gt;&lt;P&gt;if(count(StartHour)&amp;gt;=500 and Count(StartHour)&amp;lt;1000, rgb(00,150,00),&lt;/P&gt;&lt;P&gt;if(count(StartHour)&amp;gt;=1000 and Count(StartHour)&amp;lt;1500, rgb(00,255,00),&lt;/P&gt;&lt;P&gt;if(count(StartHour)&amp;gt;=1500 and Count(StartHour)&amp;lt;2000, rgb(128,255,00),&lt;/P&gt;&lt;P&gt;if(count(StartHour)&amp;gt;=2000 and Count(StartHour)&amp;lt;3000, rgb(255,255,00),&lt;/P&gt;&lt;P&gt;if(count(StartHour)&amp;gt;=3000 and Count(StartHour)&amp;lt;4000, rgb(255,244,0),&lt;/P&gt;&lt;P&gt;if(Count(StartHour)&amp;gt;=4000 and Count(StartHour)&amp;lt;4500, rgb(255,213,0), &lt;/P&gt;&lt;P&gt;if(Count(StartHour)&amp;gt;=4500 and Count(StartHour)&amp;lt;5500, rgb(255,128,0),&lt;/P&gt;&lt;P&gt;if(Count(StartHour)&amp;gt;=5500 and Count(StartHour)&amp;lt;6500, rgb(255,103,0), rgb(255,0,0)&amp;nbsp; )))))))))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This now looks a bit better but I thought it might be a bit more interesting to create a custom function within the edit module.&amp;nbsp; And here is where my issue lies.&amp;nbsp; I can use these functions from within the script editor when I'm loading data, but I can't use these functions from with any of the expression fields in the pivot table properties.&amp;nbsp; Having tried a few other things like text boxes, I can't get the functions in the edit module to work from any expression field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;This is my Function (VBScript):&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Function GetRedShade (processValue)&lt;/P&gt;&lt;P&gt;REM Return a red shade for the heat map pivot table&lt;/P&gt;&lt;P&gt;DIM redValue&lt;/P&gt;&lt;P&gt;DIM percent, shadeFactor&lt;/P&gt;&lt;P&gt;if processValue &amp;lt; 1500 then&lt;/P&gt;&lt;P&gt;&amp;nbsp; redvalue = "00"&lt;/P&gt;&lt;P&gt;elseif processValue &amp;gt;=1500 and processValue &amp;lt; 2000 then&lt;/P&gt;&lt;P&gt;&amp;nbsp; percent = (processValue/1999)*100&lt;/P&gt;&lt;P&gt;&amp;nbsp; shadeFactor = (255-128)/100&lt;/P&gt;&lt;P&gt;&amp;nbsp; redValue = (percent*shadeFactor)+128&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;&amp;nbsp; redValue = 255&lt;/P&gt;&lt;P&gt;end if&lt;/P&gt;&lt;P&gt;GetRedShade = redValue&lt;/P&gt;&lt;P&gt;end function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So when I call this from the background color definition field like this&lt;/P&gt;&lt;P&gt;rgb(GetRedShade(Count(StartHour)), GetGreenShade(Count(StartHour)), 0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get Error in expression.&amp;nbsp; So can anybody help?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2015 14:23:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Edit-Module-Functions-in-Pivot-Table-Expression/m-p/858224#M532828</guid>
      <dc:creator />
      <dc:date>2015-04-30T14:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using Edit Module Functions in Pivot Table Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Edit-Module-Functions-in-Pivot-Table-Expression/m-p/858225#M532829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, you can't use macro's in chart expressions. Well, at least not without changing an easter egg setting called AllowMacroFunctionsInExpressions. But this is obviously not recommended or it would be allowed by default.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why can't you use variables?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;vShadeFactor: (255-128)/100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;eCSH: count(StartHour)&lt;/P&gt;&lt;P&gt;ePercent:&amp;nbsp; ($1/1999)*100&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eRed: if( $(eCSH)&amp;lt; 1500, 0, if( $(eCSH)&amp;lt;2000, 128+$(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;vShadeFactor&lt;/SPAN&gt;)*$(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;ePercent($(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;eCSH&lt;/SPAN&gt;))&lt;/SPAN&gt;) , 255))&lt;/P&gt;&lt;P&gt;eGreen: ....&lt;/P&gt;&lt;P&gt;eBlue: ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cBackGround: RGB( $(eRed), $(eGreen), $(eBlue))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 May 2015 06:11:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Edit-Module-Functions-in-Pivot-Table-Expression/m-p/858225#M532829</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2015-05-01T06:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: Using Edit Module Functions in Pivot Table Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Edit-Module-Functions-in-Pivot-Table-Expression/m-p/858226#M532830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Gysbert. &lt;/P&gt;&lt;P&gt;Using Variables will make my initial attempt look a bit cleaner but won't provide the shading I'm after.&lt;/P&gt;&lt;P&gt;How do I change easter egg settings as I'm all for doing things that are not recommended?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Neil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 May 2015 10:20:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Edit-Module-Functions-in-Pivot-Table-Expression/m-p/858226#M532830</guid>
      <dc:creator />
      <dc:date>2015-05-01T10:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using Edit Module Functions in Pivot Table Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Edit-Module-Functions-in-Pivot-Table-Expression/m-p/858227#M532831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Menu --&amp;gt; Help --&amp;gt; About QlikView --&amp;gt; right click on qlik-symbol in bottom left corner&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 May 2015 10:35:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Edit-Module-Functions-in-Pivot-Table-Expression/m-p/858227#M532831</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2015-05-01T10:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using Edit Module Functions in Pivot Table Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Edit-Module-Functions-in-Pivot-Table-Expression/m-p/858228#M532832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;IMG alt="pivot-table.jpg" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/85483_pivot-table.jpg" style="width: 620px; height: 100px;" /&gt;&lt;/P&gt;&lt;P&gt;Result&lt;/P&gt;&lt;P&gt;Many Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 May 2015 10:51:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Edit-Module-Functions-in-Pivot-Table-Expression/m-p/858228#M532832</guid>
      <dc:creator />
      <dc:date>2015-05-01T10:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using Edit Module Functions in Pivot Table Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Edit-Module-Functions-in-Pivot-Table-Expression/m-p/858229#M532833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, it's certainly colorful. I think I'd try more muted colors. It's a bit of an eyesore to me to be honest. And I'd probably give the ColorMix Wizard a go first.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 May 2015 11:03:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Edit-Module-Functions-in-Pivot-Table-Expression/m-p/858229#M532833</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2015-05-01T11:03:37Z</dc:date>
    </item>
  </channel>
</rss>

