Jump to content

How can I display the 'Data Loaded at' date and time from the data canvas into a text box


Tyler Buhr

Recommended Posts

I would like to display the date and time of when an embedded data source was last refreshed/updated into the data canvas in a textbox on my visualization, the date time at the bottom of the image. I do not want the current date time, i.e datetime now,as the data is not refreshed each time the viz is opened, the backend data is manually refreshed by me. Thanks for any and all help or suggestions!
Link to comment
Share on other sites

  • 2 years later...

Hello,

To my knowledge there is no direct access to that data canvas information but here are two approaches with various pros and cons - maybe one could work for you:

1.

One solution for this that I have seen used is to include the date as part of the data.  

Example:

In an information link retrieving the data, add a column element, let's call it "Report Date". The expression for it is whatever can be used in that underlying database to get the current datetime, e.g. GETDATE(). Your returned data will contain a column that contains the report date. 

Now you can display that datetime using a calculated value in a Text Area. You'll need to get a single value to display, so e.g. use Max([Report Date])

----------

2.

>the backend data is manually refreshed by me

In this case, maybe an easy solution could be to do the refresh as well as update a document property with the refresh time using an IronPython script.

Example:

import datetime;

# Reload all data in all tables

Document.Data.Tables.ReloadAllData()

# Update the property

Document.Properties["propDataLastReloaded"] = str(datetime.datetime.now())

--------

That document property value is what you then display in your dashboard (e.g. in a text area, or in the title of a plot) to show the time of last data refresh.

Example:

datarefresh.PNG.ee4e7067933fd4d414cbc85a37a1b0a5.PNG

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...