8 Replies Latest reply on Mar 28, 2017 11:07 AM by Toby Erkson

    How to do error handling while running batch script containing TABCMD commands

    Debayan Bhattacharjya

      Hi All,

       

      I have the following sample Code,which will refresh a report by invoking tabcmd command and in case of any error it will throw an error message in log.err file..Else refresh successfully

       

      -----------------------------------------------------Code-------------------------------------------------------------------------------------------------------------------------

      echo "The Tableau daily report is about to start" >"Path\log.txt"

      "Path\tabcmd" login -s https://link// -u username -p Password -t Sitename--no-certcheck >"Path\log.txt" 2>"Path\log.err"

      echo Server Login time %date% %Time% >"Path\log.txt" 2>"Path\log.err"

      "Path\tabcmd" refreshextracts --workbook "Workbookname" --project "Automation" --synchronous --no-certcheck  >>"Path\log.txt" 2>"Path\log.err"

      if %errorlevel% EQU 0  GOTO :Success
      if %errorlevel% NEQ 0 GOTO :Error 

      :ERROR
      echo Report loading failed at time %date% %Time% .Check log error file >>"Path\log.txt"
      echo Report loading Failure >>"Path\log.err"
      exit /b

      :Success
      echo Report loading Success and Refresh completion time %date% %Time% >"Path\log.txt"

      ----------------------------------------------------------------------------------------------------------------------------------------------------------------

       

      Now this works fine in case of if there is no reports present with given name and all.But its not able to handle DB related or other report related error ,

       

      For example,for testing purpose I published a report with no user credentials embeeded and also GIVEN never allow refresh report.Now when I am refreshing the report in WEB UI I can see Status ="ERROR" with message.

       

      But the above code is unable to handle in case of TABCMD commands.

       

       

      So we need to get the Status of the report ,which if is ERROR then it should handle it in batch file along with the error message. Please note I am a site admin(not server admin) .

       

      Help is very much required, as current project of mine is completely dependent on this .