
Hi Tableau community,
I currently have multiple files in a batch script to run multiple flows.
Sometimes, one of these flows result in an error which is due to tableau. It is usually solvable by just running the flow again. I would like to catch the error, so I can then try to debug with the batch file by either running the flow again or sending me an notification if the problem continues.
This is what I am looking to do in sudo code:
cd "C:\Program Files\Tableau\Tableau Prep Builder 2022.2\scripts"
call tableau-prep-cli.bat -c "[CREDENTIAL LOCATIONS]" -t "[FLOW LOCATION]"
IF ("Flow finished sucessfully")
echo %date% %time% Flow was successful
ELSE
call tableau-prep-cli.bat -c "[CREDENTIAL LOCATIONS]" -t "[FLOW LOCATION]" -->Retry to run flow
IF ("Flow finished sucessfully")
echo %date% %time% Flow was successful
ELSE
send email to ****@***.com with the error message.
.
. --> Do the same for the other files
.
call tableau-prep-cli.bat -c [CREDENTIAL LOCATIONS_2] -t "[FLOW LOCATION_2]
My main problem is how can I catch the error in the batch file? The errors are something like the following:
The flow run failed.
Verify that all authorized and required credentials are included in the credentials.json file
and that the flow runs successfully in Tableau Prep Builder.
I am not too familiar with batch files and am trying to implement for the first time using Tableau.
Appreciate any tips or help! Thanks!
It depends on which shell you are using to run your batch file. In some scripts, you can add || after a command to indicate OR, e.g.
rm /tmp/test || echo "file /tmp/test not found"
To capture the error messages, you probably need to redirect errors with 2>&1, e.g.,
rm /tmp/test >> /tmp/log 2>&1 || echo "error logged"
To trigger an email, I used to use febootimail like lots of Tableau admins.