Accessing Older File Version Content

1. Use the report example from the MS Excel Example Report

2. Create a new version of the Artifact Instance (File) in Stages by uploading a changed MS Excel file.

3. Update the Data Set with 2 additional result columns:

NameType
AInteger
BDate
CString
Revision String
RevisionDate Date

4. Click on Preview Results in the Data Set.

Example MS Excel Extraction Script with Version Support

function dumpValues(revision, file) {
 if (file !=null) {
 var wb = new WorkbookFactory.create(file);
// var sheet = wb.getSheetAt(0);
 var sheet = wb.getSheet("Tabelle1");
 for (myrow = 1; !isCellEmpty(sheet, myrow, 0); myrow++) {
 dataset.setColumnValue("A",getNumericValue(sheet,myrow,0));
 dataset.setColumnValue("B",getDateValue(sheet,myrow,1));
 dataset.setColumnValue("C",getStringValue(sheet,myrow,2));

 dataset.setColumnValue("Revision",revision.getProperty("revisionIdentifier"));

 dataset.setColumnValue("RevisionDate",revision.getProperty("date"));

 dataset.storeResultRow();
 }
 }
 return;
}
var ArtifactName = "Excel Metric Example";
var ArtifactInstanceName = "Excel_Metric_example.xlsx";
var process = stages.getCurrentProcess();
var artifacts = process.getEntities("containsArtifact@SYSTEM");
for each (artifact in artifacts) {
 if (artifact.getProperty("DisplayName") == ArtifactName) {
 var artifacts_instances =
 artifact.getEntities("containsInstance@SYSTEM");
 for each (artifacts_instance in artifacts_instances) {
 if (artifacts_instance.getProperty("LogicalName") ==
 ArtifactInstanceName) {
 var artifact_revisions =
 artifacts_instance.getEntities("containsRevision@SYSTEM");
for each (artifact_revision in artifact_revisions) {
 var filestream = artifact_revision.getProperty("FileStream");
 dumpValues(artifact_revision, filestream);
    }
   }
  }
 }
}