4 Replies Latest reply on Jul 20, 2018 11:44 AM by Tapiwa Tapiwa

    Automate PNG or PDF creation based on a Filter

    Tapiwa Tapiwa

      Hi,
      I am trying to automate PNG or PDF creation based on a filter using tabcmd.  Below is the script that i am using to achieve that. 
      I have also tried to replicate the situation using Superstore and attached is the workbook and the excel spreadsheet with Segment names.

      Issue: So for Home Office since those are 2 words I am putting %%20 and when I run the script I am getting Home%%20Office instead of Home Office.  What I want is a space.

       

      rem echo off
      set quiet=YES
      set cDir=%cd%
      cd /d "D:\Tableau\10.5\bin"

      tabcmd login -t Development -s https://tableau.nonprod.server.net  -u User -p password --no-certcheck

      for /f "tokens=*" %%a in (C:\Temp\Segment\Segment.txt) do call :processline %%a

      :processline
      tabcmd export -t Development "/Segment Dashboard/workbookname?Segment=%1" --pdf --pagelayout landscape -f "C:\Temp\Category\Tableau PDF\%*.pdf" --no-certcheck

      REM cd /d %cDir%

       

      Someone please help!!

        • 1. Re: Automate PNG or PDF creation based on a Filter
          Naveen B

          Hi Tapiwa,

           

          As you said that Home Office

           

          URL filter should look like this to extract filtered data

           

          tabcmd export -t Development "/Segment Dashboard/workbookname?Segment=Home%20Office" whenever there is an space in the value replace with %20 instead of %%20 to pass the filter

           

          it seems you are passing the %%20 instead of %20 it will help you to filter the data.

           

          Regards,

          NB

          • 2. Re: Automate PNG or PDF creation based on a Filter
            Tapiwa Tapiwa

            Thanks for the prompt response.

            I should have mentioned that I tried %20 first and some blogs pointed me in the %%20 direction.  Both seem to be giving me the same error.

            Instead of  tabcmd export -t Development "/Segment Dashboard/workbookname?Segment=Home%20Office",

            I have         tabcmd export -t Development "/Segment Dashboard/workbookname?Segment=%1"

            because that will help with the filtering instead of listing each segment.  On the Excel that's where I tried Home%20Office and/or Home%%20Office

            Also when I run it like that I keep getting a blank PDF first then the rest of the segments PDFs.  Is that something I can do to stop the blank PDF generation

             

            Regards

            Tapiwa

             

             

             

             

            • 3. Re: Automate PNG or PDF creation based on a Filter
              Naveen B

              Hi Tapiwa,

               

              just check the below screenshot

               

               

              I am getting the pdf

               

               

              Could you please how you are running the script so that i will try to recreate the same scrip to test whats going wrong

              • 4. Re: Automate PNG or PDF creation based on a Filter
                Tapiwa Tapiwa

                The difference between what you are doing and I am doing is you are hard coding the segment, You are using Segment=Home%20Office in the script and I am using Segment=%1 so that the system can filter.  Would you try to automate such that you get all the outputs, that is all the 3 segments. I do not want to hard code because every time the segments change I have to go to script to add the new segment so that's why I used %1.  Also when you run to get the 3 outputs  would you let me know if you are getting the blank page.

                 

                The script I am running is;

                 

                rem echo off
                set quiet=YES
                set cDir=%cd%
                cd /d "D:\Tableau\10.5\bin"

                tabcmd login -t Development -s https://tableau.nonprod.server.net  -u User -p password --no-certcheck

                for /f "tokens=*" %%a in (C:\Temp\Segment\Segment.txt) do call :processline %%a

                :processline
                tabcmd export -t Development "/Segment Dashboard/workbookname?Segment=%1" --pdf --pagelayout landscape -f "C:\Temp\Category\Tableau PDF\%*.pdf" --no-certcheck

                REM cd /d %cDir%