Get Last Updated Time of Data Warehouse on Button Click for a DataCube

Hi Team,

I want to display the last updated time of Data Warehouse for a DataCube on a Button Click. I am not familiar with script code so I am looking for community support in implementing this.

Hello,

Depending on the configuration of the application (i.e. no multi-tenancy), you can probably get this information from the file metadata. To confirm if this information is available there you can open the ‘EXPLORE’ window and look at the tooltip of the data cube. If the timestamp of the last warehouse is listed there, then you can use something like the following script example to get the same information on a button click:

var getDef = this.getService("FileSystemService").getEntryById("your data cube file ID");
getDef.done(function (file) {
    var warehouseTimestamp = $E(file.metadata).first(function (kvp) {
        return kvp.key == dundas.constants.FILE_METADATA_CUBE_WAREHOUSE_TIMESTAMP;
    });
    if (warehouseTimestamp) {
        var nicelyFormattedTime = Globalize.format(dundas.Utility.getUTCOffsettedDateTime(new Date(warehouseTimestamp.value)), "F");
        // put nicelyFormattedTime somewhere now, such as in a data label
    }
});

Let me know if that works.