<?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 Macro to set column order in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Macro-to-set-column-order/m-p/1319360#M619018</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Guys, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a customizable straight table that the users create by choosing dimensions and measures.They then drag and drop the columns to the order they prefer and then bookmark specific reports.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using dynamic expressions to hide show the columns. There are over 700 measures so this has to be done. When they drag the order for the columns it then shifts the order of the column into a random order. Is there a way to set columns back into the correct order with a macro?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dimension:&lt;/P&gt;&lt;P&gt;D01: $(=SubField(Concat('['&amp;amp;%Dimension&amp;amp;']',',',FieldIndex('%Dimension',%Dimension)),',',1))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expressions:&lt;/P&gt;&lt;P&gt;E01: =$(=SubField(Concat(%Expression,'|',FieldIndex('%Expression',%Expression)),'|',1))&lt;/P&gt;&lt;P&gt;E02: =$(=SubField(Concat(%Expression,'|',FieldIndex('%Expression',%Expression)),'|',2))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be awesome if a macro could pick up the SubField() third parameter and move that column to that position. First for the dimensions then for the expression columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So user creates report with order of: &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; E02 | D01&amp;nbsp; E01&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clicks button for macro and the resulting table is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; D01 | E01 | E02&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would be cool if it worked for both pivot table and straight, but if it only works for straight that is perfectly okay too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe it is possible but I am not familiar with VBscript and have had no luck writing a script for this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 31 Mar 2017 16:37:51 GMT</pubDate>
    <dc:creator />
    <dc:date>2017-03-31T16:37:51Z</dc:date>
    <item>
      <title>Macro to set column order</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-set-column-order/m-p/1319360#M619018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Guys, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a customizable straight table that the users create by choosing dimensions and measures.They then drag and drop the columns to the order they prefer and then bookmark specific reports.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using dynamic expressions to hide show the columns. There are over 700 measures so this has to be done. When they drag the order for the columns it then shifts the order of the column into a random order. Is there a way to set columns back into the correct order with a macro?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dimension:&lt;/P&gt;&lt;P&gt;D01: $(=SubField(Concat('['&amp;amp;%Dimension&amp;amp;']',',',FieldIndex('%Dimension',%Dimension)),',',1))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expressions:&lt;/P&gt;&lt;P&gt;E01: =$(=SubField(Concat(%Expression,'|',FieldIndex('%Expression',%Expression)),'|',1))&lt;/P&gt;&lt;P&gt;E02: =$(=SubField(Concat(%Expression,'|',FieldIndex('%Expression',%Expression)),'|',2))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be awesome if a macro could pick up the SubField() third parameter and move that column to that position. First for the dimensions then for the expression columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So user creates report with order of: &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; E02 | D01&amp;nbsp; E01&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clicks button for macro and the resulting table is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; D01 | E01 | E02&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would be cool if it worked for both pivot table and straight, but if it only works for straight that is perfectly okay too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe it is possible but I am not familiar with VBscript and have had no luck writing a script for this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Mar 2017 16:37:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-set-column-order/m-p/1319360#M619018</guid>
      <dc:creator />
      <dc:date>2017-03-31T16:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to set column order</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-set-column-order/m-p/1319361#M619019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;1 Example &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Mar 2017 21:19:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-set-column-order/m-p/1319361#M619019</guid>
      <dc:creator>el_aprendiz111</dc:creator>
      <dc:date>2017-03-31T21:19:36Z</dc:date>
    </item>
  </channel>
</rss>

