Differences

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

Link to this comparison view

Last revisionBoth sides next revision
72:custom_reports_accessing_data_reading_process_subprojects [2019/02/27 20:14] – created ext-bkkr72:custom_reports_accessing_data_reading_process_subprojects [2019/03/06 18:04] ext-bkkr
Line 1: Line 1:
 ====== Reading Subprojects ====== ====== Reading Subprojects ======
  
 +This example shows how to collect data from all projects (or all subprojects).
 +
 +1. Create a report with a Stages Data Source and a Data Set.
 +
 +2. Copy the Data Set script from the example into your Data Set.
 +
 +<code>
 +/* Iterate through all projects */
 +getChilds(pkit.getRootProject());
 +/* Iterate through all subprojects */
 +//getChilds(pkit.getCurrentProject());
 +function getChilds(project)
 +{
 + var myprojects =
 + project.getEntities("hierarchy::hierarchic@LOCAL,targetrole=children");
 + for each (myproject in myprojects)
 + {
 + saveColumn(myproject);
 + getChilds(myproject);
 + }
 +}
 +function saveColumn(project)
 +{
 + var metamodel = project.getEntities("containsProcess@SYSTEM");
 + if (metamodel.length> 0 ) {
 + /* do seomthing */
 + }
 +}
 +</code>