<?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 Re: Using macro to create and change labels on a graph. in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-macro-to-create-and-change-labels-on-a-graph/m-p/847351#M297436</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have attached to the original post. The graph I am trying to do is on there along with the three list boxes that trigger an action.&amp;nbsp; The macro is also in the qvw.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Apr 2015 16:09:25 GMT</pubDate>
    <dc:creator />
    <dc:date>2015-04-03T16:09:25Z</dc:date>
    <item>
      <title>Using macro to create and change labels on a graph.</title>
      <link>https://community.qlik.com/t5/QlikView/Using-macro-to-create-and-change-labels-on-a-graph/m-p/847345#M297430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have already created a macro that will dynamically create expressions based on user's selection (only 3 list boxes have this capability).&amp;nbsp; I have been having a huge issue trying to get it to also change the label without the graph freaking out.&amp;nbsp; Below you'll find the macro code.&amp;nbsp; I have tried stuff like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e = Graph.GetProperties.Item(0).Item(0).Data.ExpressionVisual&lt;/P&gt;&lt;P&gt;e1 = e.label.v&lt;/P&gt;&lt;P&gt;e1 = "LABEL"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but it just refuses to work.&amp;nbsp; I would like to do it right after I make the expression.&amp;nbsp; Below is the code for the macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub redraw()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.GetApplication.WaitForIdle 'wait for QlikView to finish before modifying report&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'EXPRESSIONS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set graph = ActiveDocument.getSheetObject("CH54")&lt;/P&gt;&lt;P&gt;&amp;nbsp; count = 1&lt;/P&gt;&lt;P&gt;&amp;nbsp; set gp = graph.getProperties&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set prodValues = ActiveDocument.getField("Product Family").GetSelectedValues&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set buValues = ActiveDocument.getField("BU").GetSelectedValues&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set blValues = ActiveDocument.getField("Build Location").GetSelectedValues&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while count &amp;gt; 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; count = graph.RemoveExpression(0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Wend&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If prodValues.count = 0 and buValues.count = 0 and blValues.count = 0 then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; graph.addExpression "Count(distinct [Sales Order])"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for i = 0 to blValues.count-1&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; graph.addExpression "Count(distinct {1&amp;lt;[Build Location] = {" &amp;amp; blValues.Item(i).Text &amp;amp; "}&amp;gt;} [Sales Order]"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'ADD LABEL&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for j = 0 to buValues.count-1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; graph.addExpression "Count(distinct {1&amp;lt;[BU] = {" &amp;amp; buValues.Item(j).Text &amp;amp; "}&amp;gt;} [Sales Order])"&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'ADD &lt;SPAN style="font-size: 13.3333330154419px;"&gt;LABEL&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for k = 0 to prodValues.count-1&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; graph.addExpression "Count(distinct {1&amp;lt;[Product Family] = {" &amp;amp; prodValues.Item(k).Text &amp;amp; "}&amp;gt;} [Sales Order])"&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'ADD &lt;SPAN style="font-size: 13.3333330154419px;"&gt;LABEL&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; next&lt;/P&gt;&lt;P&gt;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Apr 2015 22:02:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-macro-to-create-and-change-labels-on-a-graph/m-p/847345#M297430</guid>
      <dc:creator />
      <dc:date>2015-04-02T22:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro to create and change labels on a graph.</title>
      <link>https://community.qlik.com/t5/QlikView/Using-macro-to-create-and-change-labels-on-a-graph/m-p/847346#M297431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;GetProperties method must be follow by a SetProperties to store the properties that has been assigned to the object that you did the GetProperties from...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assignment of individual properties does not take effect until you do a final SetProperties.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Search for SetProperties in the API Guide and look at the example code you find there.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Apr 2015 23:08:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-macro-to-create-and-change-labels-on-a-graph/m-p/847346#M297431</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2015-04-02T23:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro to create and change labels on a graph.</title>
      <link>https://community.qlik.com/t5/QlikView/Using-macro-to-create-and-change-labels-on-a-graph/m-p/847347#M297432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was doing that before. Every time I add a label I set the properties and then get them before hand. I'll take a look tomorrow and update with any problems.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 03:29:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-macro-to-create-and-change-labels-on-a-graph/m-p/847347#M297432</guid>
      <dc:creator />
      <dc:date>2015-04-03T03:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro to create and change labels on a graph.</title>
      <link>https://community.qlik.com/t5/QlikView/Using-macro-to-create-and-change-labels-on-a-graph/m-p/847348#M297433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Be forewarned that SetProperties is not supported in the Server environment and will sometimes give unpredictable results. (Section 81.2 of the Server Ref Guide). It's a bummer when you get it polished on the desktop and then it flakes out in the Server. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can generally achieve the same user report effect with conditional expressions and dollar sign expansions. &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, 03 Apr 2015 03:48:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-macro-to-create-and-change-labels-on-a-graph/m-p/847348#M297433</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2015-04-03T03:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro to create and change labels on a graph.</title>
      <link>https://community.qlik.com/t5/QlikView/Using-macro-to-create-and-change-labels-on-a-graph/m-p/847349#M297434</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;I can't use conditional expressions in this case because I would have to create an extremely large number upfront.&amp;nbsp; Also, I'm not sure the dollar sign expansions would work because I don't want to sum two values of a dimension if both are selected. Instead, I want to graph them as separate lines. Do you have any thoughts on how to approach this, in order for it to work from the server?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 13:22:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-macro-to-create-and-change-labels-on-a-graph/m-p/847349#M297434</guid>
      <dc:creator />
      <dc:date>2015-04-03T13:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro to create and change labels on a graph.</title>
      <link>https://community.qlik.com/t5/QlikView/Using-macro-to-create-and-change-labels-on-a-graph/m-p/847350#M297435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post a small sample qvw? Doesn't have to be real data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 15:51:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-macro-to-create-and-change-labels-on-a-graph/m-p/847350#M297435</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2015-04-03T15:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro to create and change labels on a graph.</title>
      <link>https://community.qlik.com/t5/QlikView/Using-macro-to-create-and-change-labels-on-a-graph/m-p/847351#M297436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have attached to the original post. The graph I am trying to do is on there along with the three list boxes that trigger an action.&amp;nbsp; The macro is also in the qvw.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 16:09:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-macro-to-create-and-change-labels-on-a-graph/m-p/847351#M297436</guid>
      <dc:creator />
      <dc:date>2015-04-03T16:09:25Z</dc:date>
    </item>
  </channel>
</rss>

