4 Replies Latest reply on Feb 4, 2019 5:17 AM by Jacob Krolak

    Extract Filters and Parameters From Tableau XML?

    Jacob Krolak

      Hello,

       

      I'm attempting to extract all filters and their members from the XML of a Tableau workbook. A previous post recommended to search for <filter and from there you could find all filters used in a specific workbook along with their members, however this does not seem to be working for me.

       

      Does anybody have another method of extracting filters and their members? I've spent awhile starring at the XML and it doesn't seem to be present.

       

      My goal is to be able to then use these filters and members to edit the url I provide to tabcmd with the get command. This would allow me to save possible configurations of the workbooks in a .png format.

       

      Previous Post:

      Download or extract all the filters from workbook

        • 1. Re: Extract Filters and Parameters From Tableau XML?
          Andrew Bickert

          Hi Jacob,

           

          Are you opening up the xml via .twb or .twbx. If it is a .twbx you will need to change the extension to a .zip first before opening the .twb. Also, within the XML format the Members are going to be wrapped in a '&quot;  string for text characters.

           

           

          Another way of getting this is by clicking on a sheet in your workbook and hitting CNTL + E or going to worksheets>Describe Sheet. This should show on the Shelves area all of the Filters that are applying to the sheet. You can then go to the Dimensions or Measures to see the members for each filter.

           

           

          Kind Regards,
          Andrew

          • 2. Re: Extract Filters and Parameters From Tableau XML?
            Jacob Krolak

            I am opening the .TWB - I retrieved it from tabcmd and specified a .twb format.

             

            Here is an example of what I am finding for the filters of a specific workbook - I've made some edits as I'm unsure of what exactly here is sensitive info:

             

            <filter class='categorical' column='[sqlproxy.xxxxxxxxxxxxxxx].[none:Calculation_0891110090415950:nk]'>

                        <groupfilter function='member' level='[none:Calculation_0891110090415950:nk]' member='&quot;True&quot;' user:ui-domain='database' user:ui-enumeration='inclusive' user:ui-marker='enumerate' />

                      </filter>

                      <filter class='categorical' column='[sqlproxy.xxxxxxxxxxxxxxx].[none:Calculation_1067916089360637954:nk]' filter-group='4'>

                        <groupfilter function='member' level='[none:Calculation_1067916089360637954:nk]' member='&quot;True&quot;' user:ui-domain='database' user:ui-enumeration='inclusive' user:ui-marker='enumerate' />

                      </filter>

                      <filter class='categorical' column='[sqlproxy.xxxxxxxxxxxxxxx].[none:Abbreviation:nk]' filter-group='3'>

                        <groupfilter function='member' level='[none:Office Abbreviation:nk]' member='&quot;AB&quot;' user:ui-domain='relevant' user:ui-enumeration='inclusive' user:ui-marker='enumerate' />

                      </filter>

             

            Some names don't show up - however I've found a different place in the XML that links the calculation to it's original name.

             

            Abbreviation actually had 5 possible values however, only one is showing up here!

             

            I'm looking for a way to automate this collection. Although your other tip may come in handy at some point.

            • 3. Re: Extract Filters and Parameters From Tableau XML?
              Andrew Bickert

              Ahh, Got it. Sorry I misunderstood your need initially.

               

              For the XML, are you using calculations for your Filters or perhaps Measure Values? I am using Measure Values witch will give me the calculation for each Measure Filter

              <filter class='categorical' column='[sqlproxy.03g1v5i0b0mt9i11nvcvr1saw1d3].[:Measure Names]'>

                          <groupfilter function='union' user:op='manual'>

                            <groupfilter function='member' level='[:Measure Names]' member='&quot;[sqlproxy.xxxxxxxxxxxx].[usr:Calculation_1150669721364889602:qk]&quot;' />

                            <groupfilter function='member' level='[:Measure Names]' member='&quot;[sqlproxy.xxxxxxxxxxxx].[sum:Number of Records:qk]&quot;' />

                            <groupfilter function='member' level='[:Measure Names]' member='&quot;[sqlproxy.xxxxxxxxxxxx].[avg:Calculation_1150669721364664321:qk]&quot;' />

                          </groupfilter>

                        </filter>

               

              Then in the Calculations section I can pull up the formula for these individual calculations:

              Calculation_1150669721364889602

               

              <calculations>

              ...

                        <calculation column='[Calculation_1150669721364889602]' formula='sum([Number of Records])-SUM([&gt;168])' />

              ...

                      </calculations>

               

              I have not been able to find a way to get the Member values for calculations though

               

               

              Also, do you have your filters set to "All" for at least one sheet?

               

              For reference, here is what my XMl is looking like. Here is my first sheet that I use for my Filters / Parameters set to 'All' so I can pull all of the Member Values:

              <worksheets>

                  <worksheet name='All Fitlers'>

              ...

               

                        <filter class='categorical' column='[federated.xxxxxxxxxxxxxxxx].[none:Region:nk]'>

                          <groupfilter function='union' user:ui-domain='relevant' user:ui-enumeration='inclusive' user:ui-marker='enumerate'>

                            <groupfilter function='member' level='[none:Region:nk]' member='&quot;East&quot;' />          ##(Only Using two Regions in this workbook: East and West)##

                            <groupfilter function='member' level='[none:Region:nk]' member='&quot;West&quot;' />

                          </groupfilter>

                        </filter>

                  ...

                  </worksheet>

               

              and then the worksheet specific filters (which do not contain all of the members) for the <worksheet> to </worksheet>

               

               

              <worksheets>

              <worksheet name='West Region''>

                   ...

                        <filter class='categorical' column='[federated.xxxxxxxxxxxx].[none:Region:nk]'>

                          <groupfilter function='member' level='[none:Region:nk]' member='&quot;West&quot;' user:ui-domain='relevant' user:ui-enumeration='inclusive' user:ui-marker='enumerate' />

                        </filter>

                  ...

                  </worksheet>

               

               

              Andrew

              • 4. Re: Extract Filters and Parameters From Tableau XML?
                Jacob Krolak

                So, when you have a page that has filters set to 'All' then you are able to see the parameters? I do have situations similar to your "West Region" sheet where I filter for a specific parameter and get a similar view to what you see where I can see one of the parameters. In fact, I have all of the possible parameters appear through several worksheets in the workbook - I'd like to find a method that wouldn't rely on this however. Unfortunately I don't seem to have a worksheet with that setting. Perhaps I'll create one for the workbook, I'm afraid that would increase the size of the project and slow our server however as whatever I apply this to I do plan to have in uploaded to a Tableau Server. If I'm mistaken here let me know, I'm new to Tableau - these worksheets were created by my peers.

                 

                Thanks!

                Jacob