7 Replies Latest reply on Jun 25, 2015 9:20 AM by Jeff Strauss

    PDF Subscription to SFTP Site

    Sujith Kumar Subbiah

      HI All

       

           I have a dashboard with  country data. ( Currently I have 10 countries ) 

       

      We are exploring the options to see if I can subscribe this report to generate one PDF file per country and export these files to an shared location ( either to an UNC path or to an FTP site), similar to the subscription on SSRS


      Is it possible to achieve this in Tableau, if so can you guide me on how to achieve this



      Thanks in advance


      Sujith  

        • 1. Re: PDF Subscription to SFTP Site
          Jeff Strauss

          there may be a post out there with how to do it.  Here's my thoughts of how to conceptually do it.  I hope it helps.

           

          1. write a script

           

          2. first step of script should do a tabcmd login to the server

           

          3. second step should be a for loop.  read one country at a time, pass country in as a parameter to tabcmd and use the export command to export it to a PDF and save the PDF to the appropriate UNC path

           

          4. last step do a tabcmd logout

          • 2. Re: PDF Subscription to SFTP Site
            Sujith Kumar Subbiah

            Thanks for your quick response Jeffrey

             

            I have tried and created a TabCmd command to export my workbook to a UNC path using filters

             

            this is working but I cant get around to make date filter work, below is the command I use

             

            tabcmd get "/views/Utilisationdb/Utilisation?Company=Company%20Australia&Gender=M&date=2015-01-01%3A2015-06-01" -f "\\10.200.23.22\d$\Utilisation_Aus_M.pdf"  "--no-certcheck"

             

            I have also tried and used semicolon and comma instead of %3A, still this dint work.

             

            Also , can you guide me on how to get all the country values which you can use to pass in the loop

             

            Thanks in advance for your help

             

            Sujith

            • 3. Re: PDF Subscription to SFTP Site
              Jeff Strauss

              I haven't used the get command to pass in parms, though I'm guessing it should work.  Below is an example of a for loop that reads a file (test.dat), skips the first header line (skip=1) and passes in a parm (whatgroup) which is the only column in the dat file and conceivably could be country.  It is referenced as %%G in the for loop.  and it saves to save_to_filename.csv

               

               

              FOR /F "skip=1" %%G IN (g:\test.dat) DO (tabcmd export "/workbookname/viewname?WhatGroup=%%G&:refresh=yes" -f "save_to_filename.csv" --csv

              )

              • 4. Re: PDF Subscription to SFTP Site
                Sujith Kumar Subbiah

                Thanks Jeffrey

                 

                I have tried to run your command and its providing me an error on %%G was unexpected at this time

                 

                Command I used

                 

                FOR /F "skip=1" %%G IN (C:\Temp\Company.dat) DO (tabcmd export "/Utilisationdb/Utilisation?Company=%%G&:refresh=yes" -f "save_to_filename.Pdf" --csv)

                 

                is there any thing I am missing

                 

                Once again thanks for your help

                 

                Sujith

                • 5. Re: PDF Subscription to SFTP Site
                  Jeff Strauss

                  the syntax can be a bit finicky.  I assume you're running this in a windows shell script?  if yes, then

                   

                  1. %%G only works within a bat file.  it doesn't work directly from the windows command line.  weird, huh...

                   

                  2. do you have 1 column of data in your company.dat file?

                   

                  3. move the closing ")" down to the next line or leave a space between csv and the closing ")"

                   

                  4. are you doing anything special like setlocal disableddelayedexpansion?

                   

                   

                  have a look here for more info For - Looping commands | Windows CMD | SS64.com

                  • 6. Re: PDF Subscription to SFTP Site
                    Sujith Kumar Subbiah

                    Hurray It worked, thanks Jeffrey

                     

                    I made small changes to the command and it worked  ( Mind you dint expect the commands to be case sensitive, got my head scratching for some time as I have used "P" instead of "p" on pdf :-) )

                     

                    Below is the code I have used, created a batch file and ran it through, ran like a charm

                     

                    FOR /F "skip=1" %%G IN (C:\Temp\Company.dat) DO tabcmd get "/views/Utilisationdb/Utilisation?Company=%%G&Gender=M" -f "\\10.200.23.22\d$\%%G.pdf" "--no-certcheck"

                     

                    Once again Thanks for your guidance Jeffrey

                     

                    I have one more thing to figure out, how do I get the data exported from Tableau workbook into a csv file ( For Company.dat file ) , I tried this and the result set is an empty file,

                     

                    Have you tried this?

                     

                    Sujith

                    • 7. Re: PDF Subscription to SFTP Site
                      Jeff Strauss

                      glad it worked.  to get the data, publish a report and then do a tabcmd export.  at least this is how I did it.

                       

                      tabcmd export "/workbookname/viewname?:refresh=yes" -f "filename.dat" --csv