It's all about the answers!

Ask a question

How can I filter build results in a BIRT report by tags?

Jamie Berry (14013593) | asked May 28 '14, 2:34 p.m.
edited Jun 02 '14, 4:25 a.m. by Krzysztof Kaźmierczyk (7.4k371103)
I am trying to generate a Build Results report that the user can filter by tags, team, and/or build definition name. In particular, I would like to be able to use regular expression matching for the tags and build definition name values.

I am running version 4.0.2 of the CLM server with WAS.  My Eclipse environment for developing BIRT reports is Helios with BIRT 2.6.0.

In looking at the data sources and data sets that are visible when connected to the CCM server, I noticed that the Build Results tags only showed up if I used the 'LIVE_SNAPSHOT' for my data source and used '' for my Build Result data set.  I created a join data set on the build results and build definition "tables" so I could access Build definitions.  Since I want to use regular expression matching for the tags filter, I  used a filter instead of a parameter for the tags field.  I also added a string based parameter to accept the pattern string from the user.  The JavaScript I used for the filter is:

var results = true;
if (params["TagWildcard"].value != null && params["TagWildcard"].value.length > 0) {
    var matches = row["tags"].match(params["TagWildcard"].value);
  results = (matches != null && (matches.length > 0));

When I finish setting everything up and use the 'Preview' tab on my .rptdesign file, the filter on the tags field appears to work fine.  I can even enter regular expressions and they filter out the results as expected.  I then deploy the report design to the server and attempt to run a report using the design.  In this case, the tags filtering does not work - it returns no results.

  Has anyone done something similar, either with the tags field or another?


Accepted answer

permanent link
Krzysztof Kaźmierczyk (7.4k371103) | answered May 29 '14, 6:18 a.m.
edited Jun 02 '14, 4:24 a.m.
Hi Jamie,
There is a difference between BIRT preview and the RTC report viewer in handling parameters having multiple values. See Behavioural differences between BIRT preview and the RTC report viewer section Parameter values for more information.
Let us know if that helps.
Jamie Berry selected this answer as the correct answer

Jamie Berry commented May 29 '14, 11:15 a.m. | edited May 29 '14, 11:16 a.m.

I updated my filter code to strip off leading/trailing single quotes.  The filtering works a bit better, but my filter isn't matching everything. There are tagged results that show with no filter applied that don't show when the filter should match their tag.  My new filter code is listed below.

var results = true;
var searchStr = params["TagWildcard"].value;
if (searchStr != null && searchStr.length > 0) {
    // Remove leading/trailing single quotes that may be added by the report engine
    searchStr = searchStr.replace(/^'/,"");
    searchStr = searchStr.replace(/'$/, "");
    var matches = row["tags"].match(searchStr);
  results = (matches != null && (matches.length > 0));
I haven't been able to determine any pattern to the missing results yet.
Thank you for the information and help.  It is really appreciated.


Jamie Berry commented May 29 '14, 1:58 p.m.

Success!!!  I found the issue I was having with the partial match issues.  My report uses a joined data set that had a filter set but one of the contributing data sets was also filtering data (differently) and that prevented some results.  Once I cleared the extra filter layer (and fixed some coding issues...) my report processes as expected.

Thank you again for the help.  Knowing about the added single quotes was the needed info.


Your answer

Register or to post your answer.