Differences

This shows you the differences between two versions of the page.

Link to this comparison view

72:custom_reports_accessing_data_reading_oldercontent [2019/02/27 18:28]
ext-bkkr created
72:custom_reports_accessing_data_reading_oldercontent [2019/02/27 19:54] (current)
ext-bkkr
Line 1: Line 1:
 ====== Accessing Older File Version Content ====== ====== Accessing Older File Version Content ======
 +
 +1. Use the report example from the [[:​72:​custom_reports_accessing_data_reading_msexcel|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:
 +
 +^Name^Type|
 +|A|Integer|
 +|B|Date|
 +|C|String|
 +|**Revision** |**String** |
 +|**RevisionDate** |**Date** |
 +
 +4. Click on** Preview Results** in the Data Set.
 +
 +**Example MS Excel Extraction Script with Version Support**
 +<​code>​
 +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 =
 + ​pkit.getCurrentProject().getEntities("​containsProcess@SYSTEM"​);​
 +if (process.length !=0 ) {
 + var artifacts = process[0].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);​
 +     }
 +    }
 +   }
 +  }
 + }
 +}
 +
 +</​code>​
 +
 +\\