Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
72:custom_reports_accessing_data_reading_msexcel [2019/02/27 19:02] ext-bkkr72:custom_reports_accessing_data_reading_msexcel [2019/10/04 06:59] cgl
Line 16: Line 16:
 4. Copy the example and the POI Javascript wrapper function into the Data Collection script editor of the Data Set. 4. Copy the example and the POI Javascript wrapper function into the Data Collection script editor of the Data Set.
  
-5. Include a Current metric like [[[Software Project:metric]Dashboard|]]+5. Include a Current metric like [[:software_project:metric_dashboard|metric]Dashboard]]
  
 6. Click on the Data Set on **Preview Results** 6. Click on the Data Set on **Preview Results**
  
-**Exampe MS Excel Extraction Script**+**Exampel MS Excel Extraction Script**
 <code> <code>
 function dumpValues(file) { function dumpValues(file) {
  if (file !=null) {  if (file !=null) {
  var wb = new WorkbookFactory.create(file);  var wb = new WorkbookFactory.create(file);
-// var sheet = wb.getSheetAt(0); 
  var sheet = wb.getSheet("Tabelle1");  var sheet = wb.getSheet("Tabelle1");
  for (myrow = 1; !isCellEmpty(sheet, myrow, 0); myrow++) {  for (myrow = 1; !isCellEmpty(sheet, myrow, 0); myrow++) {
Line 38: Line 37:
 var ArtifactName = "Excel Metric Example"; var ArtifactName = "Excel Metric Example";
 var ArtifactInstanceName = "Excel_Metric_example.xlsx"; var ArtifactInstanceName = "Excel_Metric_example.xlsx";
-var process = +var process = stages.getCurrentProcess(); 
- pkit.getCurrentProject().getEntities("containsProcess@SYSTEM"); +var artifacts = process.getEntities("containsArtifact@SYSTEM"); 
-if (process.length !=0 ) { +for each (artifact in artifacts) {
- var artifacts = process[0].getEntities("containsArtifact@SYSTEM"); +
- for each (artifact in artifacts) {+
  if (artifact.getProperty("DisplayName") == ArtifactName) {  if (artifact.getProperty("DisplayName") == ArtifactName) {
  var artifacts_instances =  var artifacts_instances =
Line 53: Line 50:
  }  }
  }  }
- } +}
- }+
 } }
 </code> </code>