How to show the cube date on the report using ASP

Prior to build Cognos 8.3 of it was not possible to get the cubebuild date of the mdc file. You can accomplish this by adding ASP code to the report. Since Cognos 8.3, the functions CubeCreatedOn, CubeCurrentPeriod, CubeDataUpdatedOn, CubeSchemaUpdatedOn are available in Cognos.
This article shows how you can use some ASP code to get the cube refresh date of a mdc file. This ASP is executed from Report Studio using a HTML link.

Solution

Use an ASP file to get the cube date.
Steps:
1. Create a new text file called something like getDateOnFile.asp under directory /cognos8/samples/sdk/asp/
2. Paste the following code in the file:
--------------------------------------
<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("E:\\temp\Great Outdoors Company.mdc")
Response.Write("File created: ")
Response.Write(f.DateCreated)
Response.Write("<BR>")

Response.Write("Date Last Accessed: ")
Response.Write(f.DateLastAccessed)
Response.Write("<BR>")

Response.Write("Date Last Modified: ")
Response.Write(f.DateLastModified)

set f=nothing
set fs=nothing
%>
--------------------------------------

3. Save the file
4. In Report Studio, add an HTML Item and insert a link to the ASP file.
<a href="Date" >http://<servername>/cognos8/samples/sdk/asp/getDateOnFile.asp">Date</a>

Note: You also can add other ASP code to the reports.

www.cogknowhow.com