How can build this table?

Description
JulienE
Posts: 7
Joined: Thu Jun 20, 2013 2:45 pm

How can build this table?

Postby JulienE » Mon Jun 24, 2013 9:34 am

Hello there,

I am trying to build a specific table for a wiki. Unfortunately, I can't find the way to build it correctly.
We have several types of Work Items:
Domains
--Sub domains
----Function
------RG

RG work items can be at the same level than sub domain or function, but can be under a function too.

Here is the skeleton of what I need:
For a specific domain (if possible, the domain should be choosen by the user with a dropdown select

Sub-domain XXX-1
---RG 1
---RG 2
---Function XXX-f1
------RG 3
------RG 4
Sub-domain XXX-2
---Function XXX-f2
------RG 5
------RG 6

The table should have the following columns:
  • ID (ID of the WI)
  • Title (Title of the WI)
  • Status (Enumeration)
  • Flexibility (Custom field of the RG Work Items)
  • Categories (Custom field of the RG Work Items)

Here is the code I made for the moment. A part of it has been taken here on the forum, for the Linked WI, which can be interesting for me to include too:

Code: Select all

##Récupération de l'ID du projet concerné
#set ($project_id = $page.getSpace().getProjectId())
#set ($myproject = "project.id:$project_id")
#set ($myquery = "$myproject AND type:domaine")
#set ($items = $trackerService.queryWorkItems($myquery, id))
<div>
<table class="itemsTable" style="width:100%;">
<thead> <tr>
<th width=15><b>ID</th>
<th width=70><b>Titre</th>
<th width=65><b>Linked items</th>
<th width=30><b>Status</th>
<th width=30><b>Flexibility</th>
<th width=30><b>Categories</th>
</tr> </thead>
<tbody>
      #foreach ($wi in $items)
  <tr>
  <td> {workitem: $wi.id} </td>
  <td> $wi.title </td>
  <td>
  #foreach ($link in $wi.getLinkedWorkItemsStructsBack())
    {workitem: $link.getLinkedItem().id} role: $link.getLinkRole().id <br>
  #end </td>
  <td> {workitem: status:$wi.getStatus().id|fields=id as image}</td>
  <td> </td>
  <td> </td>
  #end
  </tbody> </table>
  <div class="panelFooter" style="width:100%;"> QUERY: $myquery </i></div>
  </div>


For this code:

Code: Select all

{workitem: status:$wi.getStatus().id|fields=id as image}


I don't have the result I'm looking for, I would like to display only the icon of the status, for it gives me the ID. I tried several things, as "as image" option, but I have errors.

Any help would be appreciated. If you need more details, just let me know.
Thanks a lot!

JoernTietjen
Posts: 36
Joined: Tue Jan 10, 2012 2:08 pm
Location: nr Hamburg, Germany

Re: How can build this table?

Postby JoernTietjen » Wed Jun 26, 2013 9:22 am

Hi Julien,

IMHO the hierarchical table you are striving for is not specific but just another form of traceability. In Polarion - unlike in DOORS - there is no such thing like inherent hierarchy of workitems by a parent-child-relation. However, a link may or may not have the meaning of a hierarchy. It is up to your definition of the link role.
So, if you want a table display of linked items you may employ the traceability macros which are available on your Polarion server or are supplied by POP extensions. No need to reinvent the wheel.

If you decide to program your own macros for traceability display make sure you understand the core concepts of Polarion.
E.g. the {workitem: } macro takes a work item as input parameter nothing else. You cannot supply any other data type like a status Id and expect it to render something useful. Carefully examine the data types returned by the methods. Most of them have a toString() method which will at least render some output but it might not be the output you want.
To get familiar with the Polarion API and the data model start creating simple macros and become an expert step by step. It won't help you to copy complex source code from this forum without fully understanding it. The same may apply to POP extensions.

And one final thing: I'm deeply convinced that it is not our core business to program highly-sophisticated Velocity code for Polarion. The tool should fulfill the major part of your requirements towards requirements engineering right out of the box otherwise we should buy a different tool. So you should rather be using Polarion features and macros as they are or tweak the guys at Polarion to integrate missing features for you instead of programming (and maintain) a lot of individual extensions on your own.

Well, I surely know that hacking smart macros in Polarion is very tempting and can be a lot of fun but there is a drawback ...

Just my two cents.

Regards
Joern

sergeD
Posts: 21
Joined: Tue Feb 05, 2013 9:24 am

Re: How can build this table?

Postby sergeD » Thu Jun 27, 2013 9:18 am

Hi Julien,

Please find below some updates of your code, first to display the status as an image , and also to present the link role only as text .

I don't provide you here a final implementation of the traceability tree you want to get, but it is an other step forward.

I agree with Joern, you have to go "step by step"..by example, type $link.class or $link.getLinkedItem().class to get the object type,
explore the methods, etc.

Test it and let me know :

Code: Select all

##Récupération de l'ID du projet concerné
#set ($project_id = $page.getSpace().getProjectId())
#set ($myproject = "project.id:$project_id")
#set ($myquery = "$myproject AND type:domaine")
#set ($items = $trackerService.queryWorkItems($myquery, id))
<div>
<table class="itemsTable" style="width:100%;">
<thead> <tr>
<th width=15><b>ID</th>
<th width=70><b>Titre</th>
<th width=65><b>Linked items</th>
<th width=30><b>Status</th>
<th width=30><b>Flexibility</th>
<th width=30><b>Categories</th>
</tr> </thead>
<tbody>
      #foreach ($wi in $items)
  <tr>
  <td> {workitem: $wi.id} </td>
  <td> $wi.title </td>
  <td>
  #foreach ($link in $wi.getLinkedWorkItemsStructsBack())
   [b] $link.linkRole.name  <br>[/b]
   [b] {workitem: $link.getLinkedItem().id |fields=status as image}[/b]

  #end </td>
  <td> </td>
  <td> </td>
  #end
  </tbody> </table>
  <div class="panelFooter" style="width:100%;"> QUERY: $myquery </i></div>
  </div>


In the latest Polarion release ( 2013 SR1), a new report named "Traceability Report" is provided (reports space ) ,
it may help.

Best regards
Sergio

bschorre
Posts: 25
Joined: Mon Aug 14, 2006 10:20 am
Location: Loehne, Germany

Re: How can build this table?

Postby bschorre » Tue Jun 06, 2017 2:03 pm

Hi,

I'm trying to use this snipplets in a velocity widget. But I have no chance to display the images in this line:

Code: Select all

{workitem: $link.getLinkedItem().id |fields=status as image}


AND:
I'm trying to get the type of the linked workitem, but all I get is this:

Code: Select all

$link.linkRole.name $link.getLinkedItem().id - $link.getLinkedItem().type

==> relates to RiC-78 - EnumOption[enumId=work-item-type,id=systemrequirement]


Best Regards
tjamaker

Burgens
Posts: 1
Joined: Fri Oct 13, 2017 8:11 am

Re: How can build this table?

Postby Burgens » Wed Oct 18, 2017 8:11 am

bschorre wrote:Hi,

I'm trying to use this snipplets in a velocity widget. But I have no chance to display the images in this line:

Code: Select all

{workitem: $link.getLinkedItem().id |fields=status as image}


Best Regards
tjamaker


Hi tjamaker, did you figure out how to display the images?


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 11 guests