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:

NameType
#idString
titleString
descriptionString
modification_dateString
stateString

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.

/*
 * 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);