<?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 RemoveDimension by field name in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/RemoveDimension-by-field-name/m-p/143954#M505874</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The Dims.Count - 1 is working but it is removing the wrong field, because the code is naming the wrong one. I believe the add dimension quit working now.&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;Rem add/remove field from Subscriber Detail&lt;BR /&gt;sub addfields105&lt;BR /&gt; set btn = ActiveDocument.GetSheetObject("BU105")&lt;BR /&gt; set propb = btn.GetProperties&lt;BR /&gt; set pt = ActiveDocument.GetSheetObject("SD02")&lt;BR /&gt; Set propt = pt.GetProperties&lt;BR /&gt; set Dims = propt.Dimensions&lt;BR /&gt; if (propb.Text.v = "Add Product") then&lt;BR /&gt; propb.Text.v = "Remove Product"&lt;BR /&gt; btn.SetProperties propb&lt;BR /&gt; pt.AddDimension "Sub_ProductID"&lt;BR /&gt; set Dims = propt.Dimensions&lt;BR /&gt; propt.Dimensions(Dims.Count - 1).Title.v = "ProductID"&lt;BR /&gt; pt.SetProperties propt&lt;BR /&gt; else&lt;BR /&gt; for i = 0 to Dims.Count - 1&lt;BR /&gt; propb.Text.v = "Add Product"&lt;BR /&gt; btn.SetProperties propb&lt;BR /&gt; if propt.Dimensions(i).Title.v = "ProductID" then&lt;BR /&gt; pt.RemoveDimension i&lt;BR /&gt; end if&lt;BR /&gt; next&lt;BR /&gt; end if&lt;BR /&gt;end sub&lt;/P&gt;&lt;P&gt;:End&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 May 2009 02:59:11 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-05-13T02:59:11Z</dc:date>
    <item>
      <title>RemoveDimension by field name</title>
      <link>https://community.qlik.com/t5/QlikView/RemoveDimension-by-field-name/m-p/143947#M505867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a pivot table and I'm trying to remove a field by it's name. I found help from other posts, but I am unable to make it work correctly. Can someone help please?&lt;/P&gt;&lt;P&gt;Macro:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;addfields105&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Set&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Tabl = ActiveDocument.GetSheetObject("SD02")&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Set&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Prop = Tabl.GetProperties&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Set&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Dims = Prop.Dimensions&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;for&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;i = 0 to Dims - 1&lt;/P&gt;&lt;P&gt;if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Prop.Dimensions(i).Title.v = "Sub_ProductID"end if&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;next&lt;/P&gt;&lt;P&gt;end&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;sub&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 May 2009 21:31:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RemoveDimension-by-field-name/m-p/143947#M505867</guid>
      <dc:creator />
      <dc:date>2009-05-12T21:31:16Z</dc:date>
    </item>
    <item>
      <title>RemoveDimension by field name</title>
      <link>https://community.qlik.com/t5/QlikView/RemoveDimension-by-field-name/m-p/143948#M505868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you getting an error when running this macro?&lt;/P&gt;&lt;P&gt;It looks like the problem is with your for statement. In your macro, Dims is an object. You don't want the Dims object in your for statement, you want the count of the memebers of the Dims object.&lt;/P&gt;&lt;P&gt;Use:&lt;/P&gt;&lt;P&gt;for i = 0 to Dims.Count - 1&lt;/P&gt;&lt;P&gt;That worked for me using some sample data. Keep in mind that if you change the Title of the Dimension to something more user friendly, you will need to search for that instead of the field name. For example Prop.Dimensions(i).Title.v = "Product ID".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 May 2009 21:49:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RemoveDimension-by-field-name/m-p/143948#M505868</guid>
      <dc:creator />
      <dc:date>2009-05-12T21:49:20Z</dc:date>
    </item>
    <item>
      <title>RemoveDimension by field name</title>
      <link>https://community.qlik.com/t5/QlikView/RemoveDimension-by-field-name/m-p/143949#M505869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is what I have and still no error:&lt;B&gt;&lt;/B&gt;&lt;/P&gt;&lt;P style="font-weight: bold"&gt;sub&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;addfields105&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;&lt;P style="font-weight: bold"&gt;Set&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;Tabl = ActiveDocument.GetSheetObject("SD02" &lt;P&gt;)&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;Set&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Prop = Tabl.GetProperties&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;set&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dims = prop.Dimensions&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;for&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i = 0 to Dims.Count - 1&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;if&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;Prop.Dimensions(i).Title.v = "Sub_ProductID" &lt;P style="font-weight: bold"&gt;then&lt;/P&gt;&lt;P&gt;end&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: bold"&gt;if&lt;/P&gt;&lt;P style="font-weight: bold"&gt;next&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;end&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;sub&lt;/B&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 May 2009 23:30:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RemoveDimension-by-field-name/m-p/143949#M505869</guid>
      <dc:creator />
      <dc:date>2009-05-12T23:30:21Z</dc:date>
    </item>
    <item>
      <title>RemoveDimension by field name</title>
      <link>https://community.qlik.com/t5/QlikView/RemoveDimension-by-field-name/m-p/143950#M505870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, you do know that you have nothing in between the if statements, so if that Title is encountered, nothing happens, correct? I used the following sub and got a pop-up saying Found It! I changed the Object ID and the Dimension Title to reflect my app.&lt;/P&gt;&lt;P&gt;sub addfields105&lt;/P&gt;&lt;P&gt;Set Tabl = ActiveDocument.GetSheetObject("CH25")&lt;/P&gt;&lt;P&gt;Set Prop = Tabl.GetProperties&lt;/P&gt;&lt;P&gt;set dims = prop.Dimensions&lt;/P&gt;&lt;P&gt;for i = 0 to Dims.Count - 1&lt;/P&gt;&lt;P&gt;if Prop.Dimensions(i).Title.v = "Week" then&lt;BR /&gt; MsgBox("Found It!")&lt;BR /&gt; end if&lt;BR /&gt; next&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;P&gt;What I did to test this out on my system was to set a variable to the Title of one of the Dimensions. That way, I could see what QlikView was calling it. For your case, I would figure out what Dimension number Sub_ProductID is and then before your for statement, add:&lt;/P&gt;&lt;P&gt;ActiveDocument.Variable("vTestTitle").SetContent Prop.Dimensions(1).Title.v&lt;/P&gt;&lt;P&gt;Where 1 is the Dimension number you are looking for. Then you can make sure that the string your looking for matches the string that QlikView has.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 May 2009 23:46:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RemoveDimension-by-field-name/m-p/143950#M505870</guid>
      <dc:creator />
      <dc:date>2009-05-12T23:46:52Z</dc:date>
    </item>
    <item>
      <title>RemoveDimension by field name</title>
      <link>https://community.qlik.com/t5/QlikView/RemoveDimension-by-field-name/m-p/143951#M505871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Got it. Thanks for the help. I found that I wasn't looking for the correct property since I hadn't customized the header names yet. Thanks agin.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 May 2009 23:48:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RemoveDimension-by-field-name/m-p/143951#M505871</guid>
      <dc:creator />
      <dc:date>2009-05-12T23:48:28Z</dc:date>
    </item>
    <item>
      <title>RemoveDimension by field name</title>
      <link>https://community.qlik.com/t5/QlikView/RemoveDimension-by-field-name/m-p/143952#M505872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok. I spoke too soon. I'm still having issues finding the dimension after adding it. Here is my latest code. Is there a good way to paste code into this forum without having to replace all the tabs with spaces? The statement below chokes on the portion in bold. It says "Invalid Procedure call or argument"&lt;/P&gt;&lt;P&gt;sub addfields105&lt;BR /&gt; set btn = ActiveDocument.GetSheetObject("BU105")&lt;BR /&gt; set propb = btn.GetProperties&lt;BR /&gt; set pt = ActiveDocument.GetSheetObject("SD02")&lt;BR /&gt; Set propt = pt.GetProperties&lt;BR /&gt; set Dims = propt.Dimensions&lt;BR /&gt; if (propb.Text.v = "Add Product") then&lt;BR /&gt; propb.Text.v = "Remove Product"&lt;BR /&gt; btn.SetProperties propb&lt;BR /&gt; pt.AddDimension "Sub_ProductID"&lt;BR /&gt; &lt;STRONG&gt;propt.Dimensions(Dims.Count).Title.v = "ProductID"&lt;BR /&gt;&lt;/STRONG&gt; pt.SetProperties propt&lt;BR /&gt; else&lt;BR /&gt; for i = 0 to Dims.Count - 1&lt;BR /&gt; propb.Text.v = "Add Product"&lt;BR /&gt; btn.SetProperties propb&lt;BR /&gt; if propt.Dimensions(i).Title.v = "ProductID" then&lt;BR /&gt; pt.RemoveDimension i&lt;BR /&gt; end if&lt;BR /&gt; next&lt;BR /&gt; end if&lt;BR /&gt;end sub&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2009 01:59:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RemoveDimension-by-field-name/m-p/143952#M505872</guid>
      <dc:creator />
      <dc:date>2009-05-13T01:59:27Z</dc:date>
    </item>
    <item>
      <title>RemoveDimension by field name</title>
      <link>https://community.qlik.com/t5/QlikView/RemoveDimension-by-field-name/m-p/143953#M505873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I haven't found a good way to paste code into the forum. I usually paste it into Notepad before pasting it here to get it as plain text. I believe that may also keep your tabs.&lt;/P&gt;&lt;P&gt;I think the problem with that line is that the Count starts at 0, so there is no Dimension with the number Dims.Count. Dims.Count - 1 would be your highest numbered dim.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2009 02:49:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RemoveDimension-by-field-name/m-p/143953#M505873</guid>
      <dc:creator />
      <dc:date>2009-05-13T02:49:05Z</dc:date>
    </item>
    <item>
      <title>RemoveDimension by field name</title>
      <link>https://community.qlik.com/t5/QlikView/RemoveDimension-by-field-name/m-p/143954#M505874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The Dims.Count - 1 is working but it is removing the wrong field, because the code is naming the wrong one. I believe the add dimension quit working now.&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;Rem add/remove field from Subscriber Detail&lt;BR /&gt;sub addfields105&lt;BR /&gt; set btn = ActiveDocument.GetSheetObject("BU105")&lt;BR /&gt; set propb = btn.GetProperties&lt;BR /&gt; set pt = ActiveDocument.GetSheetObject("SD02")&lt;BR /&gt; Set propt = pt.GetProperties&lt;BR /&gt; set Dims = propt.Dimensions&lt;BR /&gt; if (propb.Text.v = "Add Product") then&lt;BR /&gt; propb.Text.v = "Remove Product"&lt;BR /&gt; btn.SetProperties propb&lt;BR /&gt; pt.AddDimension "Sub_ProductID"&lt;BR /&gt; set Dims = propt.Dimensions&lt;BR /&gt; propt.Dimensions(Dims.Count - 1).Title.v = "ProductID"&lt;BR /&gt; pt.SetProperties propt&lt;BR /&gt; else&lt;BR /&gt; for i = 0 to Dims.Count - 1&lt;BR /&gt; propb.Text.v = "Add Product"&lt;BR /&gt; btn.SetProperties propb&lt;BR /&gt; if propt.Dimensions(i).Title.v = "ProductID" then&lt;BR /&gt; pt.RemoveDimension i&lt;BR /&gt; end if&lt;BR /&gt; next&lt;BR /&gt; end if&lt;BR /&gt;end sub&lt;/P&gt;&lt;P&gt;:End&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2009 02:59:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RemoveDimension-by-field-name/m-p/143954#M505874</guid>
      <dc:creator />
      <dc:date>2009-05-13T02:59:11Z</dc:date>
    </item>
    <item>
      <title>RemoveDimension by field name</title>
      <link>https://community.qlik.com/t5/QlikView/RemoveDimension-by-field-name/m-p/143955#M505875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Weird. If you comment out the three lines after the AddDimension, the Dimension will be added successfully, but not renamed. If you leave those three lines in, the Dimension will not be added, but the highest numbered Dimension will be renamed ProductID.&lt;/P&gt;&lt;P&gt;I found a work around (I have no idea why it works this way and not the other). Do the renaming in a separate Sub.&lt;/P&gt;&lt;P&gt;sub addfields105&lt;BR /&gt; set btn = ActiveDocument.GetSheetObject("BU24")&lt;BR /&gt; set propb = btn.GetProperties&lt;BR /&gt; set pt = ActiveDocument.GetSheetObject("CH25")&lt;BR /&gt; Set propt = pt.GetProperties&lt;BR /&gt; set Dims = propt.Dimensions&lt;BR /&gt; if (propb.Text.v = "Add Product") then&lt;BR /&gt; propb.Text.v = "Remove Product"&lt;BR /&gt; btn.SetProperties propb&lt;BR /&gt; pt.AddDimension "Sub_ProductID"&lt;BR /&gt;&lt;BR /&gt; 'propt.Dimensions(Dims.Count - 1).Title.v = "ProductID"&lt;BR /&gt; 'pt.SetProperties propt&lt;BR /&gt;&lt;BR /&gt; Call newSub&lt;BR /&gt; else&lt;BR /&gt; for i = 0 to Dims.Count - 1&lt;BR /&gt; propb.Text.v = "Add Product"&lt;BR /&gt; btn.SetProperties propb&lt;BR /&gt; if propt.Dimensions(i).Title.v = "ProductID" then&lt;BR /&gt; pt.RemoveDimension i&lt;BR /&gt; end if&lt;BR /&gt; next&lt;BR /&gt; end if&lt;BR /&gt;end sub&lt;/P&gt;&lt;P&gt;sub newSub&lt;BR /&gt; set btn = ActiveDocument.GetSheetObject("BU24")&lt;BR /&gt; set propb = btn.GetProperties&lt;BR /&gt; set pt = ActiveDocument.GetSheetObject("CH25")&lt;BR /&gt; Set propt = pt.GetProperties&lt;/P&gt;&lt;P&gt;if (propb.Text.v &amp;lt;&amp;gt; "Add Product") then&lt;BR /&gt; set Dims = propt.Dimensions&lt;BR /&gt; propt.Dimensions(Dims.Count - 1).Title.v = "ProductID"&lt;BR /&gt; pt.SetProperties propt&lt;BR /&gt; end if&lt;BR /&gt;END SUB&lt;/P&gt;&lt;P&gt;The only thing odd I could find on the original is that you define Dims twice. Removing one didn't solve the problem. Other than that, the two methods should be equivilent.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2009 03:27:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RemoveDimension-by-field-name/m-p/143955#M505875</guid>
      <dc:creator />
      <dc:date>2009-05-13T03:27:55Z</dc:date>
    </item>
    <item>
      <title>RemoveDimension by field name</title>
      <link>https://community.qlik.com/t5/QlikView/RemoveDimension-by-field-name/m-p/143956#M505876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is what I ended up with:&lt;/P&gt;&lt;P&gt;sub addfields105&lt;BR /&gt; set btn = ActiveDocument.GetSheetObject("BU105")&lt;BR /&gt; set propb = btn.GetProperties&lt;BR /&gt; if (propb.Text.v = "Add Product") then&lt;BR /&gt; propb.Text.v = "Remove Product"&lt;BR /&gt; set pt = ActiveDocument.GetSheetObject("SD02")&lt;BR /&gt; pt.AddDimension "Sub_ProductID"&lt;BR /&gt; set propt = pt.GetProperties&lt;BR /&gt; btn.SetProperties propb&lt;BR /&gt; set Dims = propt.Dimensions&lt;BR /&gt; propt.Dimensions(Dims.Count - 1).Title.v = "ProductID"&lt;BR /&gt; pt.SetProperties propt&lt;BR /&gt; else&lt;BR /&gt; set pt = ActiveDocument.GetSheetObject("SD02")&lt;BR /&gt; set propt = pt.GetProperties&lt;BR /&gt; set Dims = propt.Dimensions&lt;BR /&gt; for i = 0 to Dims.Count - 1&lt;BR /&gt; propb.Text.v = "Add Product"&lt;BR /&gt; btn.SetProperties propb&lt;BR /&gt; if propt.Dimensions(i).Title.v = "ProductID" then&lt;BR /&gt; pt.RemoveDimension i&lt;BR /&gt; end if&lt;BR /&gt; next&lt;BR /&gt; end if&lt;BR /&gt;end sub&lt;/P&gt;&lt;P&gt;The only issue I have left is that when the field is added it wants to be horizonal instead of a vertical column. I'll have to look for the property to see if I can set it.&lt;/P&gt;&lt;P&gt;Thanks for all your help. If you happen to know a quick fix for my last problem. Please feel free. Thanks again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2009 03:29:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RemoveDimension-by-field-name/m-p/143956#M505876</guid>
      <dc:creator />
      <dc:date>2009-05-13T03:29:20Z</dc:date>
    </item>
  </channel>
</rss>

