1 2 Previous Next 22 Replies Latest reply on Jun 30, 2016 12:34 AM by Matt Coles

    Example: Subscriptions conditional on a successful Extract Refresh

    Matt Coles

      lalitha p , this one is for you.

       

      So, the original question was this:

       

      I have a subscription which is going on smoothly for a report now. An Extract refresh is happening at 12 O'clock and after one hour at 1:00pm my subscription is running. (daily mails are recevied by users)

      Now My concern is sometimes my report(extrcat) refresh is failing but my subscription is happening at 1 O'clock with the old data(with the last refresh data) .

       

      But i dnt want this to happen. If my refresh fails my subscription should not go or my subscription should go with a messgae that "refresh fails for today, Report is with Previous refresh or data" .

       

      Can we design our subscriptions like this with condition or atleast can i stop my subscription if my report refresh fails.

       

       

      How To (UPDATED FOR VizAlerts v1.1.0):

       

      Here are the steps you will need to follow to accomplish this for a daily subscription using VizAlerts:

       

      1. Get started with the latest version of VizAlerts! Download the Zip, and follow the instructions in install_guide.docx. Test it as the guide instructs until you know it's working. (Strongly recommend you use a test Server instance for this, of course--not Production yet until you are comfortable)

       

      2. Open the "SubscriptionWorkbook.twbx" workbook I attached to this post. You will need to adjust the Background Tasks connection for your own Tableau Server PostgreSQL repository. The sheet "Subscription" represents the subscription that you want to send. The extract it relies on is just a dummy spreadsheet. I let it refresh once successfully just so I had some data to show you in this example.

       

      3. Connect to the VizAlerts datasource (either on Tableau Server, or just use the VizAlerts.tdsx file in the zip file--doesn't matter).

       

      4. Select all all of the "Email" fields, use your mouse, right-click and pick "Copy".

       

      5. Click the Background Tasks datasource for the view you want to send. Right click on the whitespace by the fields and pick "Paste". This will add all of the fields. This has already been done in the example workbook.

       

      6. Create a new sheet and drag all of the Email fields with asterisks (*) from Background Tasks onto the Rows shelf.

       

      7. Right-click and the Subject and To fields for what you want the subject of the email to be, and what address(es) you want it sent to. *NOTE* Test this first by only sending it to yourself!

       

      8. Edit the Email Body * field so that it contains only the value 'VIZ_IMAGE(SubscriptionWorkbook/Subscription)'

       

      9. Filter the Background Tasks sheet for [Status of Job]: Success, [Extract]: SubscriptionWorkbook (workbook name), [Job Name]: Refresh Extracts, [Completed At]: Relative date, 24 hours.

       

      11. Publish your workbook to Server.

       

      12. Subscribe to the "Extract Success" view on the daily Alert subscription schedule that you set up with VizAlerts. You will want to ensure that your extract is scheduled to run prior to the Alert.

       

       

      Caveats:

       

      1. This does not automatically send the view to anyone who subscribes to it. It will only send it to the address you listed in the [ Email To *] field. If you DID want to send it to the people who've subscribed, you will need to edit the Background Tasks connection so that it also pulls in Subscriptions data--then you could use the Email fields there to construct the recipient list.

       

      2. Subscribers to this viz will still get their daily subscriptions, in addition to the one you just built. To avoid duplicates, remove everyone else's subscriptions and let them know that you're pushing the report to them instead.

       

      3. This solution will not work if you are using User Filters--everyone will be able to see the rendered viz that you would see when you access it.

       

       

      I hope that helps! I know it's a lot to take in. I highly recommend reading through the Install and User guides first--this will all make more sense that way.

       

       

      Message was edited by: Matt Coles Editing title to show that this is another use case example

       

      Message was edited by: Matt Colesv-- Adding a version that is much simpler for VizAlerts v1.1.0

        • 1. Re: Subscriptions conditional on a successful Extract Refresh
          Matt Coles

          I just realized, you don't actually need to do several of these steps if you keep it a Simple Alert. My previous example is more complicated that it really needs to be. Here's the simpler version:

           

           

          1. Get started with the latest version of VizAlerts! Download the Zip, and follow the instructions in install_guide.docx. Test it as the guide instructs until you know it's working. (Strongly recommend you use a test Server instance for this, of course--not Production yet until you are comfortable)

           

          2. Open the workbook I attached to this email. You will need to adjust the Background Tasks connection for your own PostgreSQL repository. The sheet "Subscription" represents the subscription that you want to send. The extract it relies on is just a dummy spreadsheet. I let it refresh once successfully just so I had some data to show you in this example.

           

          3. Create a new sheet and drag Number of Records from the Background Tasks datasource somewhere. Doesn't really matter where. Name the sheet whatever you like, but ensure that it has the "-" character at the beginning.

            

          4. Filter the Background Tasks sheet for [Status of Job]: Success, [Extract]: FOR_LALITHP (workbook name), [Job Name]: Refresh Extracts, [Completed At]: Relative date, 24 hours.

           

          5. If the Subscription view is not already a Dashboard, create a new Dashboard and drag the Subscription sheet into it.

           

          6. Drag the sheet you build with the text fields into your dashboard as a floating object. Place it somewhere unobtrusive. You can remove the title, make the text white, etc to hide it more effectively. (I didn't hide it in the attached workbook so you could see what is happening more easily)

           

          7. Publish your workbook to Server.

           

          8. Subscribe to the dashboard on the daily Alert subscription schedule that you set up with VizAlerts. You will want to ensure that your extract is scheduled to run prior to the Alert.

           

          9. Ensure that everyone who wishes to subscribe to this dashboard is using the same Alerts schedule that you used, which runs once per day. This ensures that their subscriptions are conditional on the extract completing successfully. They would need to make sure they're not subscribed to the view on the old Schedule, otherwise they will get duplicates.

           

           

          Caveats:

           

          1. This solution cannot send an entire Workbook full of rendered views. It can only send one View per email.

           

          2. (9) from the above list is already caveated--but basically you'd always need to make sure that subscribers to this dashboard use the daily Alerts schedule, and no other. You might be able to add that as a text instruction on the dashboard itself, to make it easier.

           

          (all the other Caveats don't apply to this version)

          • 2. Re: Subscriptions conditional on a successful Extract Refresh
            Rithesh Makkena

            Hi Matt are there any changes in vizalerts.py file as well, getting lot of errors when executing the code. Thanks again for all this

            • 3. Re: Subscriptions conditional on a successful Extract Refresh
              Matt Coles

              Hi Rithesh. What error are you getting? The most helpful thing for troubleshooting issues with VizAlerts (config issues have been the most prevalent) is to zip up the entire VizAlerts folder and send it to me (make sure that you are using filepaths for passwords in vizalerts.yaml or that you've removed the passwords before sending to me). That way I can see all the logs, the config values, and the state and temp files all at the same time. Send it to

              ...at tableau dot com.

              • 4. Re: Subscriptions conditional on a successful Extract Refresh
                Rithesh Makkena

                Thanks so much Matt for looking into this I have sent you an email. For some reason even logs are not being generated.

                • 5. Re: Example: Subscriptions conditional on a successful Extract Refresh
                  lalitha p

                  Hi Matt,

                   

                    I am unable to open the workbook. It is developed with the higher end I guess. My desktop version is 9.0. Could you please make that with the older version and attach.. help me out..

                  • 6. Re: Example: Subscriptions conditional on a successful Extract Refresh
                    Matt Coles

                    Arg, happens to me all too often. Sorry.

                     

                    I tweaked the workbook and re-attached it. It should work in 9.0 now, try it again.

                    • 7. Re: Example: Subscriptions conditional on a successful Extract Refresh
                      Toby Erkson

                      Rithesh's account has been deleted so I'm going to assume his issue has been answered.  Would've been nice to know the outcome of this...

                      • 8. Re: Example: Subscriptions conditional on a successful Extract Refresh
                        Taku Kato

                        Hi,

                         

                        I'm having trouble setting up the VizAlert to send subscribers "alerts" when an extract has refreshed successfully.

                         

                        Ive been scouring through the installation guide, user guide, and this thread for days but I still can't seem to get my head around how it works.

                        (Doesn't help that I'm a Tableau noobie)

                         

                        If there is one, could you please send me a template that will guide me on how to do this?

                         

                        Takuya

                        • 9. Re: Example: Subscriptions conditional on a successful Extract Refresh
                          Matt Coles

                          Hi Takuya. There are two ways to interpret the "alert users when an extract refreshes". Tell me which you're looking for:

                           

                          1. A user publishes a workbook to Tableau Server, based on a data extract that refreshes daily. When the extract refreshes successfully, email the user who published it to let them know that it worked properly and the data in their workbook has no issues. A simple text email is enough; all we need to do is let them know things are okay. If no email is sent, things are not okay and the user will know to investigate extract refresh failures.

                           

                          2. One or more users want to receive images of a View on Tableau Server when the data in it updates. This is just like a Subscription, but it is only sent right when the data in the extract used by that View is refreshed on Tableau Server. Users want to see the new information right when the new data comes in, so rather than subscribing to the view on a time-based schedule, they want it based on the extract refresh timing instead.

                           

                           

                          The instructions in this discussion are for scenario #2. It's actually now far easier than what I originally described, now that v1.1.0 is out.

                           

                          If you're looking for scenario #1, check out the similar version: Example: Email users whose extracts fail to refresh . In that case it'd basically be a matter of taking the workbook, flipping the filter to show successes instead of failures, and adjusting the email content.

                          • 10. Re: Example: Subscriptions conditional on a successful Extract Refresh
                            Taku Kato

                            Hi Matt,

                            Thank you for the quick response!

                             

                            I am sorry I did not communicate my query in detail.

                            The scenario I am looking for is #2. My VizAlerts version is 1.1.0.

                             

                            Takuya

                            • 11. Re: Example: Subscriptions conditional on a successful Extract Refresh
                              Matt Coles

                              The gist is the same as above, then, but there are less steps and less caveats now. I can mock something up tomorrow.

                              • 12. Re: Example: Subscriptions conditional on a successful Extract Refresh
                                Matt Coles

                                I added a simpler version and edited the instructions so that they'll work using VizAlerts v1.1.0's features. Note that in this version, you actually could send multiple views rendered as images in the subscription email. The previous version of VizAlerts could only sent the one sheet this way.

                                 

                                In the future, it'd be possible to set up VizAlerts to look for a special "extract refreshed" schedule, and lookup the extracts that'd finished for any content people'd subscribed to on it, then send mail out that way. I didn't really want to have the Admin need to set up another special schedule for that, though...we have so many little nuances you have to follow right now, anyway. But it is definitely possible to build.

                                • 13. Re: Example: Subscriptions conditional on a successful Extract Refresh
                                  Taku Kato

                                  Thank you so much Matt.

                                  I will try it out and see how it goes!

                                  • 14. Re: Example: Subscriptions conditional on a successful Extract Refresh
                                    Taku Kato

                                    Hi. Back again with 2 questions.

                                     

                                    1. I am confused as to the purpose of the created "new sheet" in step 6, when the view that you subscribe to on an alert subscription is "Extract Success" (step 12). Couldn't I just edit "Extract Success" sheet? ie Email fields and filters

                                    Could it be that the "new sheet" is just a way to setup "Extract Success"?

                                     

                                    2. Does the view that I want to detect an extract success, have to be in the same workbook as the "SubscriptionWorkbook".

                                    Since I have multiple views that I want to have detected when extract is successful, do I have to integrate all views into the "Subscription Workbook"?

                                     

                                    If you could clarify, that would be great.

                                    1 2 Previous Next