filtering linked work items

Description
peltech
Posts: 10
Joined: Fri Apr 11, 2014 10:01 am

filtering linked work items

Postby peltech » Fri Apr 25, 2014 1:15 pm

Hello,

Is it possible to filter out the work items that contains link to certain documents?
For instance.

I have a document with a few hundred of requirements, and i have test procedures to cover most of these requirements. I have linked some of these test procedures to the requirements, and i would like to see which of the requirements are missing the test cases or procedures.
I was trying to create a filter like: (NOT (linked work items: verified by)) was hoping to receive all the work items, that does not have "verified by" within its linked work items attribute, but that doesn't seem to be the case. Any suggestions or recommendation, how I could overcome this issue?

Thank you.

hseifert
Posts: 21
Joined: Wed Apr 17, 2013 12:10 pm
Location: Böblingen, Baden-Württemberg, Germany
Contact:

Re: filtering linked work items

Postby hseifert » Mon Apr 28, 2014 11:15 am

Hello,

I think something like this should work. But only within a wiki page:

Code: Select all

#set($requirements = $trackerService.queryWorkItems("type:requirement", "id"))
#set($query = "id:0")
#foreach($requirement in $requirements)
   #set($isVerified = false)
   #set($linkedStructs = $requirement.getLinkedWorkItemsStructsBack())
   #foreach($linkedStruct in $linkedStructs)
      #set($roleId = $linkedStruct.getValue("role").id)
      #if($roleId.equals("verifiedBy"))
         #set($isVerified = true)
      #end
   #end
   #if(!$isVerified)
      #set($query = "${query} OR id:${requirement.id}")
   #end
#end
{workitems:$query}
Kind regards.

Hagen

peltech
Posts: 10
Joined: Fri Apr 11, 2014 10:01 am

Re: filtering linked work items

Postby peltech » Tue Apr 29, 2014 11:21 am

Sorry, I am new to Polarion... How do you define which document does that code applies to?

Morris
Posts: 3
Joined: Thu Jan 12, 2012 8:41 am

Re: filtering linked work items

Postby Morris » Tue Apr 29, 2014 1:56 pm

Hello peltech,

like Hagen said you need a wiki page to build such a query. If you want to you can send me an email (daniel.morris@polarion.com) so we can arrange a short call/web session to talk about your request.

hseifert
Posts: 21
Joined: Wed Apr 17, 2013 12:10 pm
Location: Böblingen, Baden-Württemberg, Germany
Contact:

Re: filtering linked work items

Postby hseifert » Tue Apr 29, 2014 2:05 pm

This code applies to no document. It only searches for all requirement workitems and shows all of them without an "reviewdBy" link. Thought you can do the rest. :wink:

This code should do what you want.
  1. Notice: Replace the "###### ... ######" with your values.
  2. Notice: This is some kind of "from brain to keyboard" code, no warranty that all is semantically correct :mrgreen:
  3. Notice: Please use http://almdemo.polarion.com/polarion/sdk/doc/javadoc/index.html to understand what the code does

Code: Select all

#set($trackerProjectId = $page.getSpace().getProjectId())
#set($trackerProject = $trackerService.getTrackerProject($trackerProjectId))
#set($location = $trackerProject.location.getLocation("####### SPACE NAME #######"))
#set($modules = $trackerService.moduleManager.getModules($trackerProject, $location))
#foreach($module in $modules)
   #if($module.moduleName.equals("####### DOCUMENT NAME #######"))
      #set($document = $module)
   #end
#end
#set($containedWorkitems = $document.getContainedWorkItems())
#set($query = "id:0")
#foreach($workitem in $containedWorkitems)
   #if($workitem.type.id.equals("####### WORK ITEM TYPE ID #######"))
      #set($isVerified = false)
      #set($linkedStructs = $workitem.getLinkedWorkItemsStructsBack())
      #foreach($linkedStruct in $linkedStructs)
         #set($roleId = $linkedStruct.getValue("role").id)
         #if($roleId.equals("####### LINK ROLE ID #######"))
            #set($isVerified = true)
         #end
      #end
      #if(!$isVerified)
         #set($query = "${query} OR id:${workitem.id}")
      #end
   #end
#end
{workitems:$query}
Kind regards.

Hagen

jerrylogansquare
Posts: 2
Joined: Tue Mar 22, 2016 3:39 pm

Re: filtering linked work items

Postby jerrylogansquare » Tue Mar 22, 2016 3:48 pm

Hello,
I'm having a similar issue. :?

I want to find requirements that do not have a link to any test case.

Our the test cases are 'backlinked' to the requirements.

When I show the 'linked work items' column in the work item viewer, it does show the 'verified by' linked, which is good.
The problem is I don't know how to create a filter that will show the requirements items that have no 'verified by' links. Also, i tried a work around by exporting the work items view to excel, hoping I can use the excel filter feature to find them, BUT the backlinked items don't show up in the links column. Also, there's no 'back linked items' attribute to export when the chooser dialog box comes up.

former expert DOORS user, current newbie POLARION user,
Jerry

smarty
Posts: 50
Joined: Fri Jan 18, 2013 4:43 pm
Location: Germany / Frankfurt
Contact:

Re: filtering linked work items

Postby smarty » Wed Mar 30, 2016 5:05 pm

Hello Jerry,

this can be done with a query in a wiki page, as shown by hseifert's solution.

As a Polarion newbie you might have a look at the demo project drivepilot in your installation.
In the path <yourserver>/polarion/#/project/drivepilot/wiki/Reports/Requirements Test Coverage
there is an example wiki page, which you can copy (the source code) into a new wiki page of your project.

Regards, Martin
My environment: Polarion ALM 2016 SR2 on Windows Server 2012,
Polarion-JIRA Connector to JIRA 7.x

NickEntin
Posts: 472
Joined: Tue Oct 24, 2006 10:27 am
Location: Polarion Software GmbH, Stuttgart
Contact:

Re: filtering linked work items

Postby NickEntin » Fri Apr 01, 2016 10:59 am

a small side remark:
with the [relatively] new Live Report, you can compose such traceability view in more visual form (e.g. without much of wiki coding), and don't forget you can use SQL queries for compound statements, if you wish.

not as a reference, but just as an example (show all tasks, which are not linked, or linked only to 'heading' items):

//select additional results if you want to use them in the query
from WORKITEM
inner join PROJECT on PROJECT.C_URI = WORKITEM.FK_URI_PROJECT
//specify additional joins between tables
where true
and PROJECT.C_ID = 'NickPrj'
AND
(
not EXISTS (
SELECT STRUCT_WORKITEM_LINKEDWORKITEMS.FK_URI_WORKITEM from STRUCT_WORKITEM_LINKEDWORKITEMS
left join WORKITEM w1 on w1.C_URI = STRUCT_WORKITEM_LINKEDWORKITEMS.FK_URI_WORKITEM
WHERE STRUCT_WORKITEM_LINKEDWORKITEMS.FK_URI_P_WORKITEM=WORKITEM.C_URI
and w1.C_TYPE != 'heading'
))
AND WORKITEM.C_TYPE = 'task'

Best regards,
Nick


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 5 guests