<?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 Get expression value using Macro. in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Get-expression-value-using-Macro/m-p/1319691#M834789</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an expression that I need to reference in my Macro. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically, I had about 120 nested Ifs in the background color of one of my expressions, and Qlikview doesn't allow that many. So, I decided to write a macro instead. I need to reference the value of the expression in my macro, but I can only find ways to set expression properties, not reference the values themselves. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My If statements looked like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If(Customer = 'A'&lt;/P&gt;&lt;P&gt;and((Label = 'Metric A' and Expression &amp;lt; .95)&lt;/P&gt;&lt;P&gt;or(Label = 'Metric B' and Expression &amp;lt; .96)),red(),&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If(Customer = 'B'&lt;/P&gt;&lt;P&gt;and((Label = 'Metric B' and Expression &amp;lt; .99)&lt;/P&gt;&lt;P&gt;or(Label = 'Metric C' and Expression &amp;lt; .96)&lt;/P&gt;&lt;P&gt;or(Label = 'Metric D' and Expression &amp;lt; .90)),red(), .........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I'm attempting to write my macro as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub MakeRed&lt;/P&gt;&lt;P&gt;set Customer = ActiveDocument.Fields("Customer").GetSelectedValues&lt;/P&gt;&lt;P&gt;If Customer.Item(i).Text = "A" Then&lt;/P&gt;&lt;P&gt;&amp;nbsp; Set Labels = ActiveDocument.Fields("Label").GetPossibleValues&lt;/P&gt;&lt;P&gt;&amp;nbsp; For i = 0 to Labels.Count&lt;/P&gt;&lt;P&gt;&amp;nbsp; If Labels.Item(i).Text = 'Metric A' and&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;//here's where I need to reference the expression// ExpressionValue &amp;lt; .95)......&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Next&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;End sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help with this problem or a better suggestion would be much appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
    <dc:creator />
    <dc:date>2020-11-25T16:16:04Z</dc:date>
    <item>
      <title>Get expression value using Macro.</title>
      <link>https://community.qlik.com/t5/QlikView/Get-expression-value-using-Macro/m-p/1319691#M834789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an expression that I need to reference in my Macro. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically, I had about 120 nested Ifs in the background color of one of my expressions, and Qlikview doesn't allow that many. So, I decided to write a macro instead. I need to reference the value of the expression in my macro, but I can only find ways to set expression properties, not reference the values themselves. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My If statements looked like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If(Customer = 'A'&lt;/P&gt;&lt;P&gt;and((Label = 'Metric A' and Expression &amp;lt; .95)&lt;/P&gt;&lt;P&gt;or(Label = 'Metric B' and Expression &amp;lt; .96)),red(),&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If(Customer = 'B'&lt;/P&gt;&lt;P&gt;and((Label = 'Metric B' and Expression &amp;lt; .99)&lt;/P&gt;&lt;P&gt;or(Label = 'Metric C' and Expression &amp;lt; .96)&lt;/P&gt;&lt;P&gt;or(Label = 'Metric D' and Expression &amp;lt; .90)),red(), .........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I'm attempting to write my macro as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub MakeRed&lt;/P&gt;&lt;P&gt;set Customer = ActiveDocument.Fields("Customer").GetSelectedValues&lt;/P&gt;&lt;P&gt;If Customer.Item(i).Text = "A" Then&lt;/P&gt;&lt;P&gt;&amp;nbsp; Set Labels = ActiveDocument.Fields("Label").GetPossibleValues&lt;/P&gt;&lt;P&gt;&amp;nbsp; For i = 0 to Labels.Count&lt;/P&gt;&lt;P&gt;&amp;nbsp; If Labels.Item(i).Text = 'Metric A' and&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;//here's where I need to reference the expression// ExpressionValue &amp;lt; .95)......&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Next&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;End sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help with this problem or a better suggestion would be much appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-expression-value-using-Macro/m-p/1319691#M834789</guid>
      <dc:creator />
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Get expression value using Macro.</title>
      <link>https://community.qlik.com/t5/QlikView/Get-expression-value-using-Macro/m-p/1319692#M834790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Macros are usually not that welcomed ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Isn't there a better solution in order to replace these nested IF's? Can you do something with flagging and/or mapping?&lt;/P&gt;&lt;P&gt;Can you post an example?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Jun 2017 14:06:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-expression-value-using-Macro/m-p/1319692#M834790</guid>
      <dc:creator>prieper</dc:creator>
      <dc:date>2017-06-06T14:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: Get expression value using Macro.</title>
      <link>https://community.qlik.com/t5/QlikView/Get-expression-value-using-Macro/m-p/1319693#M834792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I posted an example of the nested IFs in my original question:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;If(Customer = 'A'&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;and((Label = 'Metric A' and Expression &amp;lt; .95)&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;or(Label = 'Metric B' and Expression &amp;lt; .96)),red(),&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;If(Customer = 'B'&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;and((Label = 'Metric B' and Expression &amp;lt; .99)&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;or(Label = 'Metric C' and Expression &amp;lt; .96)&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;or(Label = 'Metric D' and Expression &amp;lt; .90)),red(), .........&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;If there is a better solution could you clue me in?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Jun 2017 14:10:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-expression-value-using-Macro/m-p/1319693#M834792</guid>
      <dc:creator />
      <dc:date>2017-06-06T14:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: Get expression value using Macro.</title>
      <link>https://community.qlik.com/t5/QlikView/Get-expression-value-using-Macro/m-p/1319694#M834793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A bit more info might be helpful.&lt;/P&gt;&lt;P&gt;In a first approach:&lt;/P&gt;&lt;P&gt;You may put this into a separate table, like&lt;/P&gt;&lt;P&gt;LOAD * INLINE [Customer, Label, Expression&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A, MetricA, .95&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A, MetricB, .96&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B, MetricB, .99&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B, MetricC, .96&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; etc];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This table to be linked to the facttable (Customer, Label).&lt;/P&gt;&lt;P&gt;Instead of "synthetic keys", you may also create a concatenated key (AUTONUMBER(Customer&amp;amp;Label) AS KEY).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Backgroundcolor then might be: IF(SUM(Sales) &amp;gt; Expression, RED()))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Jun 2017 14:20:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-expression-value-using-Macro/m-p/1319694#M834793</guid>
      <dc:creator>prieper</dc:creator>
      <dc:date>2017-06-06T14:20:51Z</dc:date>
    </item>
  </channel>
</rss>

