cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

In a computed field, how do I count the number of items where a pick list is unspecified?

phartwig
13-Aquamarine

In a computed field, how do I count the number of items where a pick list is unspecified?

I have a picklist that is not required on an item and I want to create a computed field to count the number of items where the picklist has no value yet.  I tried to use the "Unspecified" value, but the following error is returned: 

MKS124543: The field Result is a picklist field. It may only be compared against a picklist value from that field. Unspecified is not a known picklist value.


Thank you,


Paul Hartwig

5 REPLIES 5
DanR.
12-Amethyst
(To:phartwig)

Paul,

Here is my two cents.  What if you set the value to "0" instead of "Unspecified"?  Or create a flag field (logical).  The flag could be set to true using a trigger rule.  If a value other then "Unspecified" is selected the trigger would set the flag field to "true".  Another solution (this one might work best) create a new Integer field with computed definition using SelectionCount(Your_Picklist field).  If the picklist is unspecified it will return a 0, if it has a value it will return 1.  Use the value from that field in your computed field to count the number of items where the picklist has no value.

Hope that helps.

Dan

Hi Paul,

we were also facing this problem some time ago.

We did not found a solution how to count items, where a picklist field is unspecified.

As a workaround we created a computation

<NumberOfAllItems> - <NumberOfItemsWherePicklistHasAnyValue>

For example (assuming all Picklist-Values are 0 or above:

isEmpty(

aggregateByTree("YourRelationshipField",sum(Type="YourType" ? 1 : 0)) -

aggregateByTree("YourRelationshipField",sum("YourPicklistField">=0 ? 1 : 0))

,0)

Regards

Markus

Hi Paul Hartwig‌,

Did Markus Kiessling‌'s response help at all?

Regards,
Kael


Kind Regards,
Kael Lizak

Senior Technical Support Engineer
PTC Integrity Lifecycle Manager
phartwig
13-Aquamarine
(To:KaelLizak)

Kael,

   The solution I used was provided by PTC support.  I created a 2nd field, "Picklist Status",  as a integer with the computation definition set to "SelectionCount(Picklist) == 0 ? 1: 0".  This would set the integer to 0 if the Picklist had a value and to 1 if it does not.  I then hid the field from all users using never relavent.  I then updated my original computed field, with the computation definition set to "aggregateByTree("Item Level 1","Item Level 2",Item Level 3,"Item Level 4","Item Level 5",sum(("Picklist Status" = 1) ? 1 : 0)),0)"  to count the items where the picklist status equals 1, giving me the number of items that have an unspecified value for the picklist.

If anyone would like further details, please contact me.

Paul

Hello Paul,

 

I need help in counting a relationships counts from the document and that should be display on Report.

 

Example: 

A Requirement Document have 200 contents

- 30 are non-meaningful(Headings and Comments)

- 170 are meaningful (Requirements and others..)

 

Out of 170, few Requirements are in relationships/Traced,

with Input as a Decomposed From (100 Requirements)

with Design as Satisfied By (80 Requirements)

with Testcase as Validated By (50 Requirements)

 

I want to display a count of above data in Report in Tabular form

 

1) All Content Count # (..document content count)

2) Decomposed From Count #

3) Satisfied By Count #

4) Validated By Count #

 

Would be great to know if there any resolution on this.

 

Thank You in Advance!!

 

Regards,

Chittaranjan Pise

 

Announcements


Top Tags