2 Replies Latest reply on Nov 14, 2019 2:08 AM by Steve Wood

    Export to PDF passing a filter value is failing in shell script

    Sriram Anantha Padmanaban

      Hi:

       

      I am not able to find the issue and where is the script error in getting the PDF export using the shell script attaching the script and output and need your help, Thanks in advance for you support, much appreciated.

       

      I have tried both export and get tabcmd options and no luck to get this complete.

      Error:

      *** The name of the workbook or view to export cannot include spaces. Use the normalized name of the workbook or view as it appears in the URL.

        *** The name of the workbook or view to export cannot include spaces. Use the normalized name of the workbook or view as it appears in the URL.

        *** The name of the workbook or view to export cannot include spaces. Use the normalized name of the workbook or view as it appears in the URL.

       

      Script:

      #!/bin/sh

      SERVER="https://tableau-customername.company.com/"

      SITE="customername"

      USERNAME="customernameSiteAdmin"

      PASSWORD="customernameSite@dmin"

      PROJECT="Default"

      cur_dir=""

      input=""

      output=""

      urlpath=""

      filepath=""

      #DBSERVER=$dbserver

      #DBUSER=$dbuser

      #DBPASS=$dbpwd

      #DBNAME=$dbname

      #DBPORT=$dbserverport

      export TABCMD_INSTALL_DIR=/opt/install/sync/tableau_lib

       

       

      cur_dir="$(pwd)"

      input="$cur_dir/market.txt"

      DIRECTORY="$cur_dir/marketwisePDF"

      if [ ! -d "$DIRECTORY" ]; then

        mkdir "$DIRECTORY"

      fi

      if [ -d "$DIRECTORY" ]; then

        output="$DIRECTORY/$(date +%Y%m%d_%H%M%S)"

        mkdir "$output"

      fi

      echo "$output is created"

      #https://tableau-customername.company.com/#/site/customername/views/GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly.pdf?country_name=NEW%20ZEALAND

       

       

       

       

      $TABCMD_INSTALL_DIR"/"tabcmd.sh login --no-certcheck -s $SERVER -u $USERNAME -p $PASSWORD

      $TABCMD_INSTALL_DIR"/"tabcmd.sh export "GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly" --fullpdf --pagesize tabloid -f "$output/All_Markets.pdf"

      $TABCMD_INSTALL_DIR"/"tabcmd.sh logout

      echo "*********************Start********************"

       

       

      while IFS= read -r line

      do

        urlpath="GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=$line"

        url_path=$(echo $urlpath | tr -d ' ')

        echo "url_path=$url_path"

        filepath="$output/$line.pdf"

        $TABCMD_INSTALL_DIR"/"tabcmd.sh login --no-certcheck -s $SERVER -u $USERNAME -p $PASSWORD

        $TABCMD_INSTALL_DIR"/"tabcmd.sh export $url_path --pdf -f $filepath --no-certcheck

        $TABCMD_INSTALL_DIR"/"tabcmd.sh logout

      done < "$input"

       

      Error:

      Output of the execution:

      /home/psriram/Automation/marketwisePDF/20191011_061639 is created

      ===== Creating new session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      ===== Connecting to the server...

      ===== Signing in...

      ===== Succeeded

      ===== Continuing previous session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      =====     Site:     customername

      ===== Requesting 'GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly' from the server...

      ===== Saved GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly to '/home/psriram/Automation/marketwisePDF/20191011_061639/All_Markets.pdf'

      ===== redirecting to https://tableau-customername.company.com/auth

      ===== Signed out

      *********************Start********************

      url_path=GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=AUSTRALIA

      ===== Creating new session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      ===== Connecting to the server...

      ===== Signing in...

      ===== Succeeded

      ===== Continuing previous session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      =====     Site:     customername

      ===== Requesting 'GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=AUSTRALIA

      ' from the server...

      ===== redirecting to https://tableau-customername.company.com/auth

      ===== Signed out

      url_path=GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=BAHRAIN

      ===== Creating new session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      ===== Connecting to the server...

      ===== Signing in...

      ===== Succeeded

      ===== Continuing previous session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      =====     Site:     customername

      ===== Requesting 'GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=BAHRAIN

      ' from the server...

      ===== redirecting to https://tableau-customername.company.com/auth

      ===== Signed out

      url_path=GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=BULGARIA

      ===== Creating new session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      ===== Connecting to the server...

      ===== Signing in...

      ===== Succeeded

      ===== Continuing previous session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      =====     Site:     customername

      ===== Requesting 'GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=BULGARIA

      ' from the server...

      ===== redirecting to https://tableau-customername.company.com/auth

      ===== Signed out

      url_path=GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=CANADA

      ===== Creating new session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      ===== Connecting to the server...

      ===== Signing in...

      ===== Succeeded

      ===== Continuing previous session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      =====     Site:     customername

      ===== Requesting 'GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=CANADA

      ' from the server...

      ===== redirecting to https://tableau-customername.company.com/auth

      ===== Signed out

      url_path=GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=COSTA%20RICA

      ===== Creating new session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      ===== Connecting to the server...

      ===== Signing in...

      ===== Succeeded

      ===== Continuing previous session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      =====     Site:     customername

      ===== Requesting 'GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=COSTA%20RICA

      ' from the server...

      ===== redirecting to https://tableau-customername.company.com/auth

      ===== Signed out

      url_path=GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=ECUADOR

      ===== Creating new session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      ===== Connecting to the server...

      ===== Signing in...

      ===== Succeeded

      ===== Continuing previous session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      =====     Site:     customername

      ===== Requesting 'GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=ECUADOR

      ' from the server...

      ===== redirecting to https://tableau-customername.company.com/auth

      ===== Signed out

      url_path=GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=EGYPT

      ===== Creating new session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      ===== Connecting to the server...

      ===== Signing in...

      ===== Succeeded

      ===== Continuing previous session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      =====     Site:     customername

      ===== Requesting 'GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=EGYPT

      ' from the server...

      ===== redirecting to https://tableau-customername.company.com/auth

      ===== Signed out

      url_path=GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=HONG%20KONG

      ===== Creating new session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      ===== Connecting to the server...

      ===== Signing in...

      ===== Succeeded

      ===== Continuing previous session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      =====     Site:     customername

      ===== Requesting 'GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=HONG%20KONG

      ' from the server...

      ===== redirecting to https://tableau-customername.company.com/auth

      ===== Signed out

      url_path=GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=HUNGARY

      ===== Creating new session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      ===== Connecting to the server...

      ===== Signing in...

      ===== Succeeded

      ===== Continuing previous session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      =====     Site:     customername

      ===== Requesting 'GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=HUNGARY

      ' from the server...

      ===== redirecting to https://tableau-customername.company.com/auth

      ===== Signed out

      url_path=GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=INDIA

      ===== Creating new session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      ===== Connecting to the server...

      ===== Signing in...

      ===== Succeeded

      ===== Continuing previous session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      =====     Site:     customername

      ===== Requesting 'GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=INDIA

      ' from the server...

      ===== redirecting to https://tableau-customername.company.com/auth

      ===== Signed out

      url_path=GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=INDONESIA

      ===== Creating new session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      ===== Connecting to the server...

      ===== Signing in...

      ===== Succeeded

      ===== Continuing previous session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      =====     Site:     customername

      ===== Requesting 'GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=INDONESIA

      ' from the server...

      ===== redirecting to https://tableau-customername.company.com/auth

      ===== Signed out

      url_path=GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=JAPAN

      ===== Creating new session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      ===== Connecting to the server...

      ===== Signing in...

      ===== Succeeded

      ===== Continuing previous session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      =====     Site:     customername

      ===== Requesting 'GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=JAPAN

      ' from the server...

      ===== redirecting to https://tableau-customername.company.com/auth

      ===== Signed out

      url_path=GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=JORDAN

      ===== Creating new session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      ===== Connecting to the server...

      ===== Signing in...

      ===== Succeeded

      ===== Continuing previous session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      =====     Site:     customername

      ===== Requesting 'GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=JORDAN

      ' from the server...

      ===== redirecting to https://tableau-customername.company.com/auth

      ===== Signed out

      url_path=GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=KUWAIT

      ===== Creating new session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      ===== Connecting to the server...

      ===== Signing in...

      ===== Succeeded

      ===== Continuing previous session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      =====     Site:     customername

      ===== Requesting 'GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=KUWAIT

      ' from the server...

      ===== redirecting to https://tableau-customername.company.com/auth

      ===== Signed out

      url_path=GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=LEBANON

      ===== Creating new session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      ===== Connecting to the server...

      ===== Signing in...

      ===== Succeeded

      ===== Continuing previous session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      =====     Site:     customername

      ===== Requesting 'GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=LEBANON

      ' from the server...

      ===== redirecting to https://tableau-customername.company.com/auth

      ===== Signed out

      url_path=GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=MALAYSIA

      ===== Creating new session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      ===== Connecting to the server...

      ===== Signing in...

      ===== Succeeded

      ===== Continuing previous session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      =====     Site:     customername

      ===== Requesting 'GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=MALAYSIA

      ' from the server...

      ===== redirecting to https://tableau-customername.company.com/auth

      ===== Signed out

      url_path=GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=MALTA

      ===== Creating new session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      ===== Connecting to the server...

      ===== Signing in...

      ===== Succeeded

      ===== Continuing previous session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      =====     Site:     customername

      ===== Requesting 'GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=MALTA

      ' from the server...

      ===== redirecting to https://tableau-customername.company.com/auth

      ===== Signed out

      url_path=GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=MEXICO

      ===== Creating new session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      ===== Connecting to the server...

      ===== Signing in...

      ===== Succeeded

      ===== Continuing previous session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      =====     Site:     customername

      ===== Requesting 'GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=MEXICO

      ' from the server...

      ===== redirecting to https://tableau-customername.company.com/auth

      ===== Signed out

      url_path=GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=NEW%20ZEALAND

      ===== Creating new session

      =====     Server:   https://tableau-customername.company.com/

      =====     Username: customernameSiteAdmin

      ===== Connecting to the server...

      ===== Signing in...

      ===== Succeeded

        • 1. Re: Export to PDF passing a filter value is failing in shell script
          Sriram Anantha Padmanaban

          Any pointer to fix this issue is very much appreciated and not sure what is the error?

          • 2. Re: Export to PDF passing a filter value is failing in shell script
            Steve Wood

            Hi there, I remember hitting that issue but look to be in a different environment to you (Windows command line and TABCMD). Having said that, and in case it helps, some differences I see from a working script I have are:

            • The URL I'm using doesn't end in a slash, so instead of:
              GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly/?country_name=NEW%20ZEALAND
              I would have
              GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly?country_name=NEW%20ZEALAND
              (No slash before the "?")
            • And I had to double escape the % for %20 in Windows command line, so instead of:
              GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly?country_name=NEW%20ZEALAND
              I would have
              GlobalSiteStatisticsMonthly/GLOBALSITESTATISTICSMonthly?country_name=NEW%%20ZEALAND
              (Two % in the replacement for space)

             

            I also recall having to make sure the workbook and view names were correct and had no spaces. But spaces in those doesn't look like a problem for you. I hope this helps or someone who has seen the issue in your setup can comment! Good luck.

             

            Steve.