Differences
This shows you the differences between two versions of the page.
Last revisionBoth sides next revision | |||
72:custom_reports_accessing_data_reading_process_comment_report [2019/02/27 20:12] – created ext-bkkr | 72:custom_reports_accessing_data_reading_process_comment_report [2019/03/06 17:38] – ext-bkkr | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Creating an Annotation/ | ====== Creating an Annotation/ | ||
+ | |||
+ | This example reads all annotations from all sub workspaces of the current one. | ||
+ | |||
+ | 1. Create a report with a Stages Data Source and a Data Set. | ||
+ | |||
+ | 2. Create the following Data Set result columns: | ||
+ | |||
+ | ^Name^Type| | ||
+ | |Project|String| | ||
+ | |Element|String| | ||
+ | |ElementSubtype|String| | ||
+ | |AnnotationName|String| | ||
+ | |Description|String| | ||
+ | |Timestamp|String| | ||
+ | |LastChangeUser|String| | ||
+ | |ElementId|String| | ||
+ | |ElementType|String| | ||
+ | |||
+ | 3. Copy the Data Set script from the example into your Data Set. | ||
+ | |||
+ | < | ||
+ | function getChildren(project){ | ||
+ | var myprojects = | ||
+ | | ||
+ | for each (myproject in myprojects) | ||
+ | { | ||
+ | | ||
+ | | ||
+ | } | ||
+ | } | ||
+ | function existsInArray (element, array){ | ||
+ | for (var i = 0; i < | ||
+ | if (element.equals(array[i])){ | ||
+ | | ||
+ | } | ||
+ | } | ||
+ | | ||
+ | } | ||
+ | function saveColumn(project){ | ||
+ | // | ||
+ | var id = project.getProperty(" | ||
+ | var projectName = project.getProperty(" | ||
+ | var process = project.getEntities(" | ||
+ | // | ||
+ | if (process != null){ | ||
+ | //get all elementtypes | ||
+ | if | ||
+ | ( process.getPkitClass().isAssociationValid(" | ||
+ | { | ||
+ | var allAnnotations = process.getEntities(" | ||
+ | for each (annotation in allAnnotations){ | ||
+ | var importantAssocNames = new Array(); | ||
+ | var allAssocsForAnnotation = | ||
+ | | ||
+ | if (allAssocsForAnnotation.length> | ||
+ | //go through all assocs, filter out the ones we don't need and | ||
+ | | ||
+ | for each (assoc in allAssocsForAnnotation) { | ||
+ | if ((assoc.getName() != " | ||
+ | && | ||
+ | if (existsInArray(assoc.getName(), | ||
+ | | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | //go through all important assocs of the annotation, get the | ||
+ | | ||
+ | for each (oneImportantAssocName in importantAssocNames){ | ||
+ | var elements = annotation.getEntities(oneImportantAssocName); | ||
+ | for each (element in elements){ | ||
+ | var elementType = element.getProperty(" | ||
+ | if (element.getProperty(" | ||
+ | var propertyPath = process.getProperty(" | ||
+ | | ||
+ | + elementType.toLowerCase(); | ||
+ | } | ||
+ | else{ | ||
+ | var propertyPath = process.getProperty(" | ||
+ | | ||
+ | + elementType.toLowerCase() + " | ||
+ | + element.getProperty(" | ||
+ | } | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }} | ||
+ | } | ||
+ | /////////// Start of script /////////// | ||
+ | // | ||
+ | properties_de = new Properties(); | ||
+ | //stream_en = new FileInputStream(" | ||
+ | LocalPKit.properties" | ||
+ | stream_de = new FileInputStream(" | ||
+ | LocalPKit_de.properties" | ||
+ | // | ||
+ | properties_de.load(stream_de); | ||
+ | // | ||
+ | stream_de.close(); | ||
+ | var currentProject = pkit.getCurrentProject(); | ||
+ | saveColumn(currentProject); | ||
+ | /* Iterate through all subprojects */ | ||
+ | getChildren(currentProject); | ||
+ | </ | ||
+ | |||
+ | \\ | ||