Display the date of the last data import

You can display the date of the last data import on the HTML page of a MV.

The date is queried via JavaScript from a MV component using the getLastImportDate() method. It can be queried in the language-independent format yyyy-MM-dd'T'HH:mm:ss or in the language-specific format of the login language. To display the date, you must specify a callback method when calling the init method, which will receive the date as a string parameter.

Extract from /webapp/assets/javascript/mvhelper.js

function MVFlexComponent() {

/**

* Get the timestamp of last data import

* @param callbackMethod the timestamp will be delivered by calling this call-back-method

* supporting one string parameter

* (in the time zone of the source system)

* @param bLocalized false -> Output format: "yyyy-MM-dd'T'HH:mm:ss"

* true -> Output format: localized for login language

*/

this.getLastImportDate = function(callbackMethod, bLocalized);

}

The date can only be queried using the getLastImportDate() method after the MV component announced via the ON_CREATION_COMPLETE event that its creation is complete.

Example: How it works

var mv1 = new MVFlexComponent();

function initMVComponents() {

mv1.init("mvParent1", "%5CDetails%5CSales%5CCycleTime_2",

"FAVORITES_SHARED", "FLEX", "100%", "400", [], "",

{"ON_CREATION_COMPLETE":"onCreationCompleteCallback"});

}

// only for MVFlexComponent

function onCreationCompleteCallback() {

mv1.getLastImportDate("getLastImportDateCallback", true);

}

// only for MVFlexComponent

function getLastImportDateCallback(sLastImportDate) {

. . .

}

Complete use case:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">

<html>

<head>

<script language="JavaScript" type="text/javascript" src="../assets/flex/AC_OETags.js"></script>

<script language="JavaScript" type="text/javascript" src="../assets/javascript/mvhelper.js"></script>

<script language="JavaScript" type="text/javascript" src="../assets/javascript/linkhelper.js"></script>

<script language="JavaScript" type="text/javascript" src="../assets/javascript/pngfix.js"></script>

<script language="JavaScript" type="text/javascript">

initializeFlex();

//

// Make the global filter of a running dashboard available for this management view

//

var dashboardGlobalFilter = new DashboardGlobalFilterConnector();

//

// MVComponents must be declared here (so that they are reachable from any point on the page)

//

var mv1 = new MVFlexComponent();

//

// MVComponents must be initialized here (after page has loaded)

//

function initMVComponents() {

mv1.init("mvParent1", "%5CDetails%5CSales%5CCycleTime_2", "FAVORITES_SHARED", "FLEX", "100%", "400", [], "", {"ON_CREATION_COMPLETE":"onCreationCompleteCallback"});

}

// only for MVFlexComponent

function onCreationCompleteCallback() {

mv1.getLastImportDate("getLastImportDateCallback", true);

}

// only for MVFlexComponent

function getLastImportDateCallback(sLastImportDate) {

document.getElementById("mvParentLastImportDate").innerHTML = "Last import: " + sLastImportDate;

}

</script>

</head>

<body onload="initMVComponents();">

<div>

<table cellpadding="0" cellspacing="0" rules="none" frame="void" border="0" bgcolor="#FFFFFF" width="100%" height="100%">

<tbody>

<tr>

<td id="mvParentLastImportDate" width="100%" align="right" style="color: black; font: 8pt Verdana,Arial; padding-right: 10pt" nowrap />

</tr>

</tbody>

</table>

</div>

<div>

<table cellpadding="0" cellspacing="0" rules="none" frame="void" border="0" bgcolor="#FFFFFF" width="100%" height="100%">

<tbody>

<tr>

<td id="mvParent1"/>

</tr>

</tbody>

</table>

</div>

</body>

</html>