Skip to main content
4-Participant
May 20, 2026
Question

Create an attribute to sort Documents with secondary content

  • May 20, 2026
  • 4 replies
  • 75 views

Hello,

I’m trying to create an attribute that could verify if a document posses a secondary content (a boolean would be enough) 

Once created, I will use that attribute in the advanced search’s view,  to be able to sort and show if the document has a secondary content or not 

I’m on Windchill 10.2, with my new standart attribute “HasSecondaryContent” in the type “Document”, but I don’t know how get the information about the secondary content into my attribute, or to add it in the list of attributes in the view modification’s window (I see it on the document detail page)

Do you have some hints to help me create that attribute ?

4 replies

17-Peridot
May 20, 2026

Hi ​@KévinM,

To retrieve objects that contain secondary content through an attribute in Advanced Search, the attribute value must first be persisted.
I would suggest updating the attribute value whenever content is attached or removed.
Additionally, for existing objects, you may need to create and run a utility to populate or update the attribute values accordingly.

20-Turquoise
May 20, 2026

You could do this with a custom calculated attribute:

New java algorithm for calculated attributes (BusinessAlgorithm) starting Windchill 11.0

https://www.ptc.com/en/support/article/CS226468

 

And using the following api’s:
How to programmatically get object attachments in Windchill PDMLink

https://www.ptc.com/en/support/article/CS58556

 

 

20-Turquoise
May 20, 2026

And like ​@TDT says you can’t advanced search for calculated attributes but these attributes will be available as column(s) to add in the Search Results table. Which you can then do as you described in that table.

18-Opal
May 22, 2026

@KévinM ,

Any reason you have not upgraded to a more recent/supported version of a Windchill.

 

You can find objects that have attachments (or not) with Query Builder. You don’t need to the “HasSecondaryContent”.

 

That said, to do it they way you describe with “HasSecondaryContent” is doable but you will need a custom utility to set the value to true for all objects that currently have secondary content.

You will also need a custom listener to automatically update objects when attachments are added or removed.

 

Both ways are very doable. Your call on which way you want to go with.

 

David

Contact me

KévinM4-ParticipantAuthor
4-Participant
May 22, 2026

I’m not the lead on the project so I’m sadly stuck on this outdated version because… reasons, I supposed. And updating it is not in the realm of the possible for this project, sadly :/

 

Sadly the Query Builder will not do IMO, because the goal is to show the users that the documents they found with the advanced search has secondary content or not. Doing a report with the Query builder is not necessary 

 

For the custom utility and listener, i suppose i’ll need to dive into the code do make them. I haven’t thought about the existing objects with attachement, so thank for the reminder. Now my issue will be to locate were to write that code down i suppose.

Community Moderator
June 1, 2026

Hi ​@KévinM,

I wanted to see if you got the help you needed.

If so, please mark the appropriate reply as the Accepted Solution. It will help other members who may have the same question.
Of course, if you have more to share on your issue, please pursue the conversation.

Thanks,
Anurag