Requirements per Document in Live Page Pie Chart

Description
bherfurth
Posts: 5
Joined: Fri Jun 26, 2015 12:24 pm

Requirements per Document in Live Page Pie Chart

Postby bherfurth » Fri Jun 26, 2015 12:33 pm

Hello,

i am trying, for some time now, to create a pie chart via a Live Page.
This pie chart should display requirements seperated by an attribute. Lets say the "status" of the requirement.

The users want to be able to set the document from which the requirements are taken.
So i created a pageParameter, that selects all possible requirements documents.
The user can select multiple values to evaluate requirements from multiple documents.

Well, ... thats the plan. i have tried many differents approaches until now, but i won't get it to work.
Can someone help me out, since i am not the best in lucene+velocity.
What i think it should look like is:

if i try to join the paramater to a string an then check if the document title of the requirement appears in it:

Code: Select all

$pageParameters.ReqDocuments.join(";").contains(???)


or

if i somehow get the document represantation as the page parameter has it:

Code: Select all

$pageParameters.ReqDocuments.contains(???)


??? should be something like document.title, module, module.name, ... i have tried many things.

many thanks in advance for helping.

Ben

martins
Posts: 181
Joined: Thu Nov 05, 2009 3:24 pm

Re: Requirements per Document in Live Page Pie Chart

Postby martins » Mon Jun 29, 2015 11:34 am

Hello Ben,

Looking at the integrated Wiki help of Polarion (http://almdemo.polarion.com/polarion/wi ... Parameters) you'll find method "getAsString" for the pageParameters.

Code: Select all

$pageParameters.getAsString("ReqDocuments")
should give you a string including all selected documents in your parameter "ReqDocuments". This string you can use in your query to limit results to the selected documents, e. g.:

Code: Select all

document.id:(${pageParameters.getAsString("ReqDocuments")})


Kind regards

Martin

bherfurth
Posts: 5
Joined: Fri Jun 26, 2015 12:24 pm

Re: Requirements per Document in Live Page Pie Chart

Postby bherfurth » Mon Jun 29, 2015 1:47 pm

Hello Martin,

pasting your query to my widget results in the following error:
Failed to parse query: ((type:externalRequirement AND ((document.id:(${pageParameters.getAsString("ReqDocuments")})) AND status:draft)) AND project.id:LTT) AND NOT IS_LOCAL:true
Status to CustomerWorkItemexternalRequirementluceneVelocitydocument.id:(${pageParameters.getAsString("ReqDocuments")})statustruefalse
Status to CustomerWorkItemexternalRequirementluceneVelocitydocument.id:(${pageParameters.getAsString("ReqDocuments")})statustruefalse


If i leave out the {} around the pageParameters, it just won't deliver any results, but it should.

something is going wrong there, but i don't get what.

Maybe you could unveil the mistery?
Last edited by bherfurth on Thu Jul 16, 2015 1:59 pm, edited 1 time in total.

martins
Posts: 181
Joined: Thu Nov 05, 2009 3:24 pm

Re: Requirements per Document in Live Page Pie Chart

Postby martins » Tue Jun 30, 2015 5:47 am

Hello Ben,

how is your pageParameter "ReqDocuments" defined?

Have you tried to output just the result of

Code: Select all

${pageParameters.getAsString("ReqDocuments")})
?
If this does not show the id of the selected document (including space name) your parameter definition is obvious wrong. So go back two steps and check your pageParameter selection first before entering this value into your query.

Kind regards

Martin

bherfurth
Posts: 5
Joined: Fri Jun 26, 2015 12:24 pm

Re: Requirements per Document in Live Page Pie Chart

Postby bherfurth » Tue Jun 30, 2015 7:48 am

Hey Martin,

my pageParameter is of type enumeration.

what gives me a List in the form of:

Code: Select all

("Space / Doc1" "Space / Doc2")


is:

Code: Select all

$pageParameters.ReqDocuments.toLucene


but using this one like you told me before does not work either.

I think the getAsString method does work in classic wiki but not in the new Pages?

afoldesi
Posts: 1
Joined: Tue Aug 16, 2016 1:17 pm
Location: Budapest,H

Re: Requirements per Document in Live Page Pie Chart

Postby afoldesi » Fri Dec 02, 2016 5:28 pm

Dear All,

It seems to me that I have the same problem: I cannot filter for work items contained in selected documents.
Does anyone have a solution for this issue?

The docu_list below is of enum type 'Document' that is set in a Page Parameter widget.

Code: Select all

<div class="polarion-rp-widget-part" data-widget="com.polarion.multiSetTrendChart">
  <span class="polarion-rp-widget-parameters">
    <sub id="title">WI's in selected Specifications</sub>
    <sub id="data">
      <sub id="elements">
        <sub>
          <sub id="prototype">WorkItem</sub>
          <sub id="subtype">businessFeature</sub>
          <sub id="queryType">luceneVelocity</sub>
          <sub id="luceneQuery">document.id=($pageParameters.docu_list.toLucene)</sub>
          ...


$pageParameters.docu_list.toLucene returns ("Space/Doc1_id" "Space/Doc2_id") format that seems to be not working for document.id query.

However ("Space/Doc1_title Space/Doc2_title") works fine if I 'wire' it manually to the query.

Is there a way to get the document title instead of its ID? Or maybe a different method should be used to filter according to documents?

Thank You!
Arpad

fbachmann
Posts: 55
Joined: Thu Apr 24, 2014 12:10 pm

Re: Requirements per Document in Live Page Pie Chart

Postby fbachmann » Wed Jun 10, 2020 2:25 pm

I recently had the same problem with a Document enumeration as input to several widget queries.

In my case, it was a combination of two causes, one inherent to Polarion and the other to our data:

1. the spaceId / documentId returned from the Document enumeration has spaces on both sides of the slash. You'll need to use

Code: Select all

$pageParameters.selectedDocument.singleValue().id.replaceAll(" / ","/")
to get rid of it (thanks, Polarion Support!).
2. if your spaceId contains space character(s), you'll need to put quotes around the spaceId/documentId string, which brings you to a string like

Code: Select all

document.id:"$pageParameters.selectedDocument.singleValue().id.replaceAll(" / ","/")"


If your query is inside a string, you'll need to escape the quotes using {esc.q}, as here:

Code: Select all

#set($numCovered=$trackerService.dataService.getInstancesCount("WorkItem", "projet.id:$projectId AND document.id:${esc.q}$pageParameters.selectedDocument.singleValue().id.replaceAll(" / ","/")${esc.q} AND backlinkedWorkItems:$prefix*"))


I'd be happy to learn about any simpler solution, if they exist...
Hope this helps, François


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 15 guests