Skip to main content
14-Alexandrite
June 7, 2021
Question

How to compute the count of Requirements having no Assigned User Set in a RQ Doc?

  • June 7, 2021
  • 2 replies
  • 1482 views

I tried to execute the computation in report computation,

 

Example,

Lets RQ  Document = having 21 Functional Requirements

2 Functional Requirements assigned to „Responsible User“=userA (i.e. assigned to me)

1 Functional Requirements set „Responsible User“=userB

So, here i would like to find the count of such Functional Requirements having no „Responsible User“ set. Ans should be 18.

 

Usecase 1 : Find the count of Requirements which is assigned to me (i.e. Responsible User assigned to me)

aggregate("Contains", ByDocument(false, false), sum((Category="Functional Requirements" and "Responsible User"=me)?1:0))

This computation is executing correctly, count=2.

 

Usecase 2 : Find the count of Specifications which is not assigned to me (i.e. Responsible User not assigned to me)

aggregate("Contains", ByDocument(false, false), sum((Category="Functional Requirements" and "Responsible User"!=me)?1:0))

This computation is executing with count=1. but The answer suppose to be 19 [(userB) + 18 which was unassigned]. Its skipping the count of 18.

 

 

Usecase 3 : Whether is it possible to find the the Responsible User which are not assigned ?

aggregate("Contains", ByDocument(false, false), sum((Category="Functional Requirements" and "Responsible User"!=)?1:0))

Not working!!

 

Kindly let me know what should we consider "Responsible User"!= here for getting the count of Responsible users which is not assigned.

2 replies

16-Pearl
June 7, 2021

The problem is that there is no way to test for "Null", "unassigned", "empty", etc. in computations.

I've hit this problem many times in the past. I may be wrong but I haven't found a way. I've even tried things like "Responsible User" == emptyUser() ? ... but that doesn't work either.

This said, your post prompted me to try again and I think I found a solution!

The function SelectionCount is meant to count the number of items in a multi-field, but it works with a single value field too. It returns 0 for unassigned, so we can test for that. I tried with "Assigned User" on my system and was able to get this:

Count of assigned users in document: aggregate( "Contains", ByDocument(true,true), sum(  SelectionCount("Assigned User") ) )

Count of unassigned users: aggregate( "Contains", ByDocument(true,true), sum(  SelectionCount("Assigned User")==0 ? 1 : 0 ) )

The trick is to flip 0 to 1 when checking for unassigned which I did with the test. I think that combining that with your other conditions will get you there. Please let us know if that works for you.

 

 

14-Alexandrite
July 15, 2021

Thanks You for the reply, the count is working as expected.