Differences

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

Link to this comparison view

72:custom_reports_accessing_data_reading_issues [2019/02/07 14:05]
ext-bkkr created
72:custom_reports_accessing_data_reading_issues [2019/03/06 18:21] (current)
ext-bkkr
Line 1: Line 1:
 ====== Reading Issues from Stages ====== ====== Reading Issues from Stages ======
 +
 +This example reads all issues from the current project and returns a given number of columns.
 +
 +1. Create a Report with a Stages Data Source and a Data Set.
 +
 +2. Create the following Data Set result columns:
 +
 +^Name^Type|
 +|#​id|String|
 +|title|String|
 +|description|String|
 +|modification_date|String|
 +|state|String|
 +
 +//Notice: The name of the columns must be the same as the ident name of the issue tracker attributes in the PKitRequest.xml configuration//​.
 +
 +3. Copy the Data Set script from the example into your Data Set.
 +
 +<​code>​
 +/*
 + * Stores all Issues (filtered by filterfunc) with or without history
 + */
 +function GetRequests(myProject,​ myAllColumns,​withHistory,​filterfunc) {
 + var requests = myProject.getEntities("​containsRequest@SYSTEM"​);​
 + for each (request in requests) {
 + if (withHistory) {
 + var histories = request.getEntities("​containsHistory@SYSTEM"​);​
 + for each (history in histories) {
 + if ((filterfunc.call(arguments[1],​history))) {
 + for each (AllColumn in AllColumns ) {
 + ​dataset.setColumnValue(AllColumn,​ history.getProperty(AllColumn));​
 + }
 + ​dataset.storeResultRow();​
 + }
 + }
 + } else {
 + for each (request in requests) {
 + if ((filterfunc.call(arguments[1],​request))) {
 + for each (AllColumn in AllColumns ) {
 + ​dataset.setColumnValue(AllColumn,​ request.getProperty(AllColumn));​
 + }
 + ​dataset.storeResultRow();​
 + }
 + }
 + }
 + }
 + }
 +function myfilter(request) {
 + var val = request.getProperty("​state"​).toLowerCase();​
 + ​return (val != "/* Filtervalue */"​.toLowerCase())
 +}
 + var AllColumns = new Array("#​id","​title",​ "​description",​
 + "​modification_date","​state"​);​
 + ​GetRequests(pkit.getCurrentProject(),​ AllColumns, false, myfilter);
 +</​code>​
 +
 +\\