<?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 Is this a hard constraint on pivoting axis using macro automation? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210264#M589922</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;NumberOfLeftDimensions is a property of TableProperties. You're best to use the API Guide.qvw document to explore the OLE Automation API. I have pasted a code sample showing how it works.&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;BR /&gt;rem Create HLO system table on new sheet&lt;BR /&gt;set Sheet=ActiveDocument.CreateSheet&lt;BR /&gt;set Hlo=Sheet.CreatePivotTable&lt;BR /&gt;Hlo.AddDimension "$Field"&lt;BR /&gt;Hlo.AddDimension "$Table"&lt;BR /&gt;Hlo.AddExpression "Only([$Field])"&lt;BR /&gt;set Prop = Hlo.GetProperties&lt;BR /&gt;Prop.TableProperties.PivotAlwaysFullyExpanded=true&lt;BR /&gt;Prop.Dimensions.Item(0).SortCriteria.SortByAscii=0&lt;BR /&gt;Prop.Dimensions.Item(0).SortCriteria.SortByLoadOrder=1&lt;BR /&gt;Prop.Dimensions.Item(1).SortCriteria.SortByAscii=0&lt;BR /&gt;Prop.Dimensions.Item(1).SortCriteria.SortByLoadOrder=1&lt;BR /&gt;Prop.TableProperties.NumberOfLeftDimensions = 1&lt;BR /&gt;Hlo.SetProperties Prop&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Sep 2010 16:22:22 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-09-07T16:22:22Z</dc:date>
    <item>
      <title>Is this a hard constraint on pivoting axis using macro automation?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210260#M589918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It took me a while to figure out how to pivot rows into columns when automatically building a new Pivot Table chart. Normally, the only way to do this is by dragging the row into a column, which changes the dimension from being on the vertical axis, to the horizontal axis.&lt;/P&gt;&lt;P&gt;The trick (it would appear) is to use the NumberOfLeftDimensions property. By default, this property is set to the number of dimensions in the Pivot Table. If you set this property to be an explicit value - e.g. 1, then all dimensions after the first dimension will be placed horizontally instead of vertically. Furthermore, if you increase the "NumberOfLeftDimensions" property to be greater than the number of dimensions, then this has the effect of moving expressions from columns to rows.&lt;/P&gt;&lt;P&gt;Therefore it is possible to have near complete control over the Pivot Table axis layout.&lt;/P&gt;&lt;P&gt;That notwithstanding, there is one scenario where I have not been able to figure out a way of controlling the layout through automation. Namely, I cannot find a way to tell the Pivot Table that I want to keep one or more expressions on the vertical axis, but keep one or more of my dimensions on the horizontal axis. It is possible to move expressions to my axis ,but only if all of my dimensions are already on the vertical axis. In other words, I cannot mix dimensions and expressions on my vertical axis, while having a dimension on the horizontal axis. But this is possible through mouse dragging.&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jan 2010 23:36:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210260#M589918</guid>
      <dc:creator />
      <dc:date>2010-01-12T23:36:47Z</dc:date>
    </item>
    <item>
      <title>Is this a hard constraint on pivoting axis using macro automation?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210261#M589919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Neil,&lt;/P&gt;&lt;P&gt;I get the same problem when trying to achieve same outcome. My thinking is that there is a gap b/w the underlying table definition and what is available to the automation. With the single value NumberOfLeftDimensinos it is impossible to have some fields on the horizontal axis and expressions on the vertical.&lt;/P&gt;&lt;P&gt;Have you reported this to QlikTech as a bug or enhancement?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Sep 2010 06:16:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210261#M589919</guid>
      <dc:creator>michael_anthony</dc:creator>
      <dc:date>2010-09-02T06:16:08Z</dc:date>
    </item>
    <item>
      <title>Is this a hard constraint on pivoting axis using macro automation?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210262#M589920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's been a long time since I attempted something like this, but I remember having similar trouble trying to set up my horizontal and vertical dimensions and expressions using the API. I remember concluding what Michael says, that the necessary controls simply weren't available in the API. Now, I don't guarantee that I'm remembering it correctly, and even if I am, I don't guarantee that I didn't just miss something. But yeah, I couldn't find it in the API either. I didn't report it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Sep 2010 01:27:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210262#M589920</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-09-03T01:27:56Z</dc:date>
    </item>
    <item>
      <title>Is this a hard constraint on pivoting axis using macro automation?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210263#M589921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm new at Qlikview and came across your post, I was wondering if you could tell me where I could find the "NumberOfLeftDimensions" property?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Sep 2010 06:59:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210263#M589921</guid>
      <dc:creator />
      <dc:date>2010-09-06T06:59:40Z</dc:date>
    </item>
    <item>
      <title>Is this a hard constraint on pivoting axis using macro automation?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210264#M589922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;NumberOfLeftDimensions is a property of TableProperties. You're best to use the API Guide.qvw document to explore the OLE Automation API. I have pasted a code sample showing how it works.&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;BR /&gt;rem Create HLO system table on new sheet&lt;BR /&gt;set Sheet=ActiveDocument.CreateSheet&lt;BR /&gt;set Hlo=Sheet.CreatePivotTable&lt;BR /&gt;Hlo.AddDimension "$Field"&lt;BR /&gt;Hlo.AddDimension "$Table"&lt;BR /&gt;Hlo.AddExpression "Only([$Field])"&lt;BR /&gt;set Prop = Hlo.GetProperties&lt;BR /&gt;Prop.TableProperties.PivotAlwaysFullyExpanded=true&lt;BR /&gt;Prop.Dimensions.Item(0).SortCriteria.SortByAscii=0&lt;BR /&gt;Prop.Dimensions.Item(0).SortCriteria.SortByLoadOrder=1&lt;BR /&gt;Prop.Dimensions.Item(1).SortCriteria.SortByAscii=0&lt;BR /&gt;Prop.Dimensions.Item(1).SortCriteria.SortByLoadOrder=1&lt;BR /&gt;Prop.TableProperties.NumberOfLeftDimensions = 1&lt;BR /&gt;Hlo.SetProperties Prop&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Sep 2010 16:22:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210264#M589922</guid>
      <dc:creator />
      <dc:date>2010-09-07T16:22:22Z</dc:date>
    </item>
    <item>
      <title>Is this a hard constraint on pivoting axis using macro automation?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210265#M589923</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 have a similar but simpler problem, I have 1 or 2 dimensions I need to add via API that need to be at the top of a Pivot Table (header) with the expressions displayed down the side (vertically). It appears you have mastered this much but I seem to be having problems. Can you share the "NumberOfLeftDimensions" code where you had the expressions on the side and the dimensions in the header?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Oct 2010 20:24:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210265#M589923</guid>
      <dc:creator />
      <dc:date>2010-10-12T20:24:28Z</dc:date>
    </item>
    <item>
      <title>Is this a hard constraint on pivoting axis using macro automation?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210266#M589924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've pasted a code excerpt below, that should help.&lt;/P&gt;&lt;P&gt;Basically the gist of it is that you need to remove all dimensions and add them back in again. I think that's the "gotcha". Also, if you use "Indent Mode", you need to turn it off while manipulating the dimensions, and then turn it back on again. Also, I recommend you detach the chart before performing these manipulations, and then reattaching the chart. Otherwise you'll likely experience lock-up.&lt;/P&gt;&lt;P&gt;I should also point out, that I don't use this approach any longer, and instead am using Calculated Dimensions to show/hide levels. In general, I've found that messing around with adding and removing dimensions through VB Script causes performance issues, in large part because it messes up chart caching. That said, your situation may be different.&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; set chrtOrgQuestions = ActiveDocument.GetSheetObject(csScoredQuestionsChartId)&lt;BR /&gt; chrtOrgQuestions.detach&lt;BR /&gt; RebuildOrgChartDimensions chrtOrgQuestions, iShortestPath&lt;BR /&gt; chrtOrgQuestions.attach&lt;BR /&gt;&lt;BR /&gt;sub RebuildOrgChartDimensions (chrtCur, iShortestPath)&lt;BR /&gt; dim propChart&lt;BR /&gt; dim dimsChart&lt;BR /&gt; dim asSecondaryDimensions&lt;BR /&gt; dim i&lt;BR /&gt; dim iOrgRollupFieldLen&lt;BR /&gt; dim iCurSecondaryDimension&lt;BR /&gt; dim dimCur, fldCur&lt;BR /&gt; dim iDimIdx&lt;BR /&gt; dim dimSG1_QShortDesc2&lt;BR /&gt; dim iSG1_QShortDesc2_dim_idx&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; iCurSecondaryDimension = 0&lt;BR /&gt; iOrgRollupFieldLen = len(csOrgRollupField)&lt;BR /&gt; redim asSecondaryDimensions(0)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; set propChart = chrtCur.GetProperties&lt;BR /&gt; set dimsChart = propChart.Dimensions&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; '1. Cache the the current secondary dimensions, while at the same time removing all dimensions&lt;BR /&gt; for i = 0 to dimsChart.Count - 1&lt;BR /&gt;' msgbox "Cur iteration: " &amp;amp; i&lt;BR /&gt; if strcomp(left(dimsChart(i).PseudoDef.name, iOrgRollupFieldLen), csOrgRollupField) &amp;lt;&amp;gt; 0 then&lt;BR /&gt;' msgbox "Found a difference: " &amp;amp; dimsChart(i).PseudoDef.name&lt;BR /&gt; redim preserve asSecondaryDimensions(iCurSecondaryDimension)&lt;BR /&gt; asSecondaryDimensions(iCurSecondaryDimension) = dimsChart(i).PseudoDef.name&lt;BR /&gt; iCurSecondaryDimension = iCurSecondaryDimension + 1&lt;BR /&gt; end if&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; chrtCur.RemoveDimension(0)&lt;BR /&gt; next&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; '2. Add back all ORG dimensions&lt;BR /&gt; for i = 1 to iShortestPath&lt;BR /&gt; chrtCur.AddDimension csOrgRollupField &amp;amp; i&lt;BR /&gt; next&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; '3. Add back the secondary dimensions&lt;BR /&gt; if iCurSecondaryDimension &amp;gt; 0 then&lt;BR /&gt; for i = 0 to iCurSecondaryDimension - 1&lt;BR /&gt; 'NB: This code must be refactored to show partial sums for all non-root and non-direct-child-of-root score groups&lt;BR /&gt; iDimIdx = chrtCur.AddDimension(asSecondaryDimensions(i))&lt;BR /&gt; if strcomp(asSecondaryDimensions(i), csSG1_QShortDesc2) = 0 then&lt;BR /&gt; iSG1_QShortDesc2_dim_idx = iDimIdx&lt;BR /&gt; end if&lt;BR /&gt; next&lt;BR /&gt; end if&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; '****WARNING WARNING DANGER DANGER&lt;BR /&gt; 'It is necessary to refresh the chart properties object reference before pivoting&lt;BR /&gt; set propChart = chrtCur.GetProperties&lt;BR /&gt; with propChart&lt;BR /&gt; .TableProperties.NumberOfLeftDimensions = iShortestPath&lt;BR /&gt;&lt;BR /&gt; end with&lt;BR /&gt; chrtCur.SetProperties propChart&lt;BR /&gt;&lt;BR /&gt;end sub&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Oct 2010 20:52:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210266#M589924</guid>
      <dc:creator />
      <dc:date>2010-10-12T20:52:24Z</dc:date>
    </item>
    <item>
      <title>Is this a hard constraint on pivoting axis using macro automation?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210267#M589925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the prompt reply. I too had tried to use Calculated Dimensions rather than macro script but could not find a way to get the sorting right as you can't use things like Sort by Expression or Sort by Load Order with Calculated Dimensions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Oct 2010 21:08:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210267#M589925</guid>
      <dc:creator />
      <dc:date>2010-10-12T21:08:44Z</dc:date>
    </item>
    <item>
      <title>Is this a hard constraint on pivoting axis using macro automation?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210268#M589926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can't explicitly set the sort order, but I've found that by default it sorts by Load Order.&lt;BR /&gt;So, depending on what you're doing, it may be possible to control sort order of Calculated Dimension by loading it in the order you want.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Oct 2010 21:12:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210268#M589926</guid>
      <dc:creator />
      <dc:date>2010-10-12T21:12:18Z</dc:date>
    </item>
    <item>
      <title>Is this a hard constraint on pivoting axis using macro automation?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210269#M589928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Neil,&lt;/P&gt;&lt;P&gt;did you find a solution for mixing dimensions and expressions on vertical axis, while having a dimension on the horizontal axis? Thanks for you answer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Jan 2011 14:59:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210269#M589928</guid>
      <dc:creator />
      <dc:date>2011-01-31T14:59:20Z</dc:date>
    </item>
    <item>
      <title>Is this a hard constraint on pivoting axis using macro automation?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210270#M589930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nope - nothing beyond NumberOfLeftDimensions.&lt;/P&gt;&lt;P&gt;However, if you're looking to generate document layouts ahead of time it's possible to achieve whatever layout you desire through XML manipulation. Although this won't help you when you're trying to performing interactive chart manipulations.&lt;/P&gt;&lt;P&gt;That said, I've since changed my approach to QlikView, and generally avoid using VB macros whenever possible to achieve my goals. Instead, it's better to drive everything by way of expressions. In some cases you can achieve your goals by pre-creating chart layouts and then using Show/Hide Expressions. However, there are limits to this approach.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Jan 2011 15:10:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210270#M589930</guid>
      <dc:creator />
      <dc:date>2011-01-31T15:10:26Z</dc:date>
    </item>
    <item>
      <title>Is this a hard constraint on pivoting axis using macro automation?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210271#M589932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Neil,&lt;/P&gt;&lt;P&gt;thanks for your fast answer. Iam trying to save a pivot table layout, my users are building via Mouse Drag and Drop. (e.g. expressions on vertical axis, dimensions on horizontal). I save all Dimensions and Expressions in QV Variables with the help of a QV Bookmark. Whenever my users are reloading this Bookmark, their saved Pivot Table is rebuilded via VB Macros. Now i am searching for a way, so save a Drag and Drop Layout in a Bookmark.&lt;BR /&gt;&lt;BR /&gt;Martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Jan 2011 16:35:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-this-a-hard-constraint-on-pivoting-axis-using-macro/m-p/210271#M589932</guid>
      <dc:creator />
      <dc:date>2011-01-31T16:35:16Z</dc:date>
    </item>
  </channel>
</rss>

