Differences

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

Link to this comparison view

72:custom_reports_accessing_data_reading_msproject [2019/02/27 18:27]
ext-bkkr created
72:custom_reports_accessing_data_reading_msproject [2019/02/27 19:46] (current)
ext-bkkr
Line 1: Line 1:
 ====== Reading MS Project Files ====== ====== Reading MS Project Files ======
 +
 +The used Java library MPXJ Version 4.3 is able to read MS Project files up to Version 2010.
 +
 +1. Create a Report with a Stages Data Source
 +
 +2. Create an Artifact and create an Artifact Instance (File) in Stages by uploading a MS Project file.
 +
 +3. Create a Data Set with the following result columns:
 +
 +^Name^Type|
 +|task|String|
 +|ID|String|
 +|start|Date|
 +|finish|Date|
 +|work|String|
 +
 +4. Include a Current metric like [[[Software Project:​metric]Dashboard|]]
 +
 +5. Click on the Data Set on **Preview Results**
 +
 +**Example MS Project Extraction Script**
 +<​code>​
 +function dumpValues(filename,​ filestream) {
 + if (filestream !=null) {
 + ​reader = ProjectReaderUtility.getProjectReader(filename);​
 + ​projectfile = reader.read(filestream);​
 +
 + if (projectfile!= null) {
 + var Tasks = projectfile.getAllTasks().toArray();​
 + for (jj=0; jj<​Tasks.length;​ jj++ )
 + {
 + task = Tasks[jj];
 + ​dataset.setColumnValue("​ID",​task.getID() );
 + ​dataset.setColumnValue("​tasks",​task.getName() );
 + ​dataset.setColumnValue("​tasks",​task.getName() );
 + ​dataset.setColumnValue("​start",​task.getStart() );
 + ​dataset.setColumnValue("​finish",​task.getFinish() );
 + ​dataset.setColumnValue("​work",​task.getWork() );
 + ​dataset.storeResultRow();​
 + }
 + }
 +  }
 +}
 +var ArtifactName = "​Project Metric Example";​
 +var ArtifactInstanceName = "​Project_Metric_example.mpp";​
 +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 filestream = artifacts_instance.getProperty("​FileStream"​);​
 + ​dumpValues(artifacts_instance.getProperty("​PhysicalName"​),​
 + ​filestream);​
 + }
 + }
 + }
 + }
 +}
 +</​code>​
 +
 +\\