<?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: Sorting GetPossibleValues in Macro in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sorting-GetPossibleValues-in-Macro/m-p/330696#M121780</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;the problem is that your Diemnsion and Name is not stored with a connection to eachother.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you load them into one field and then split them it would work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Dimension &amp;amp; '|' &amp;amp; DimensionName AS Dimensionfield,&lt;/P&gt;&lt;P&gt;..&lt;/P&gt;&lt;P&gt;ORDER BY&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Dimension, DimensionName&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And then split them in then macro&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for i=0 to dimSelection.Count - 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;chart.AddDimension SUBFIELD(dimSelection.Item(i).text, '|', 1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'rename an expression label&lt;/P&gt;&lt;P&gt;set p = chart.GetProperties&lt;/P&gt;&lt;P&gt;set dims = p.Dimensions(i)&lt;/P&gt;&lt;P&gt;dims.Title.v = SUBFIELD(dimName.Item(i).Text, '|', 2)&lt;/P&gt;&lt;P&gt;dims.LabelAdjust = 1 'center&lt;/P&gt;&lt;P&gt;chart.SetProperties p&lt;/P&gt;&lt;P&gt;'SET p=Nothing &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Apr 2013 14:27:40 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-04-09T14:27:40Z</dc:date>
    <item>
      <title>Sorting GetPossibleValues in Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Sorting-GetPossibleValues-in-Macro/m-p/330694#M121778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using QV10.&amp;nbsp; I am building a straight table chart dynamically.&amp;nbsp; The dimensions and the expressions are sourced from tables.&amp;nbsp; I make a selection from a list box and the macro finds the field values and field names from the table for the selected value.&amp;nbsp; The table is sorted in the order that the fields should appear in the chart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At first it seemed to be working perfectly, but sometimes the field values and field names are in different order so that the field gets the wrong name and the columns are in the wrong order.&amp;nbsp; The field names seems to be sorting correctly, it is the field values that are off. Below is the snipit of code that it performing this action.&amp;nbsp; Any help is appreciated!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;'add dimensions&lt;BR /&gt;set dimSelection = ActiveDocument.fields("Dimension").GetPossibleValues&lt;BR /&gt;set dimName = ActiveDocument.fields("DimensionName").GetPossibleValues&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;for i=0 to dimSelection.Count - 1&lt;BR /&gt;&lt;BR /&gt;msgbox(dimSelection.Item(i).text)&lt;BR /&gt;msgbox(dimName.Item(i).text)&lt;BR /&gt;chart.AddDimension dimSelection.Item(i).text&lt;BR /&gt;&lt;BR /&gt;'rename an expression label&lt;BR /&gt;set p = chart.GetProperties&lt;BR /&gt;set dims = p.Dimensions(i)&lt;BR /&gt;dims.Title.v = dimName.Item(i).Text&lt;BR /&gt;dims.LabelAdjust = 1 'center&lt;BR /&gt;chart.SetProperties p&lt;BR /&gt;'SET p=Nothing &lt;BR /&gt;&lt;BR /&gt;next &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 May 2012 18:59:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sorting-GetPossibleValues-in-Macro/m-p/330694#M121778</guid>
      <dc:creator>wnorwood</dc:creator>
      <dc:date>2012-05-01T18:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting GetPossibleValues in Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Sorting-GetPossibleValues-in-Macro/m-p/330695#M121779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have similar problem to solve.&lt;/P&gt;&lt;P&gt;I want to GetPossibleValues in alphabetical order. But as far as i'm aware GetPossibleValue uses the load order of the field.&lt;/P&gt;&lt;P&gt;So if you make sure you load the values in that field in the order you want that might help.&lt;/P&gt;&lt;P&gt;I'm still looking for the alphabetical solution though.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Y&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2012 09:26:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sorting-GetPossibleValues-in-Macro/m-p/330695#M121779</guid>
      <dc:creator>yavoro</dc:creator>
      <dc:date>2012-06-21T09:26:15Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting GetPossibleValues in Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Sorting-GetPossibleValues-in-Macro/m-p/330696#M121780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;the problem is that your Diemnsion and Name is not stored with a connection to eachother.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you load them into one field and then split them it would work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Dimension &amp;amp; '|' &amp;amp; DimensionName AS Dimensionfield,&lt;/P&gt;&lt;P&gt;..&lt;/P&gt;&lt;P&gt;ORDER BY&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Dimension, DimensionName&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And then split them in then macro&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for i=0 to dimSelection.Count - 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;chart.AddDimension SUBFIELD(dimSelection.Item(i).text, '|', 1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'rename an expression label&lt;/P&gt;&lt;P&gt;set p = chart.GetProperties&lt;/P&gt;&lt;P&gt;set dims = p.Dimensions(i)&lt;/P&gt;&lt;P&gt;dims.Title.v = SUBFIELD(dimName.Item(i).Text, '|', 2)&lt;/P&gt;&lt;P&gt;dims.LabelAdjust = 1 'center&lt;/P&gt;&lt;P&gt;chart.SetProperties p&lt;/P&gt;&lt;P&gt;'SET p=Nothing &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Apr 2013 14:27:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sorting-GetPossibleValues-in-Macro/m-p/330696#M121780</guid>
      <dc:creator />
      <dc:date>2013-04-09T14:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting GetPossibleValues in Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Sorting-GetPossibleValues-in-Macro/m-p/330697#M121781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alternative to read a field you could put the dimension + name in a tablebox - see APIGuide.qvw for examples like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set table = ActiveDocument.GetSheetObject( "CH01" )&lt;/P&gt;&lt;P&gt;CellRect = ActiveDocument.GetApplication().GetEmptyRect()&lt;/P&gt;&lt;P&gt;CellRect.Top = 0&lt;/P&gt;&lt;P&gt;CellRect.Left = 0&lt;/P&gt;&lt;P&gt;CellRect.Width = table.GetColumnCount&lt;/P&gt;&lt;P&gt;CellRect.Height = table.GetRowCount&lt;/P&gt;&lt;P&gt;set CellMatrix = table.GetCells( CellRect )&lt;/P&gt;&lt;P&gt;for RowIter=CellRect.Top to CellRect.Height-1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for ColIter=CellRect.Left to CellRect.Width-1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; msgbox(CellMatrix(RowIter)(ColIter).Text)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; next&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For sorting an array see examples like this (BubbleSort):&lt;/P&gt;&lt;P&gt;&lt;A class="loading active_link" href="http://www.robvanderwoude.com/vbstech_data_array.php" title="http://www.robvanderwoude.com/vbstech_data_array.php"&gt;http://www.robvanderwoude.com/vbstech_data_array.php&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Apr 2013 16:04:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sorting-GetPossibleValues-in-Macro/m-p/330697#M121781</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2013-04-09T16:04:18Z</dc:date>
    </item>
  </channel>
</rss>

