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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

How to get the displayIdentifier from a task name

mariaSutton
8-Gravel

How to get the displayIdentifier from a task name

Hi, I am trying to add a column to a custom report that collects Task data. The new column will show the highlighted number (in this example: "00041") in the task name/description. 

The debug says this field is ColumnID: "displayIdentifier" coming from Row Object: wt.change2.WTChangerRequest2. 

MR_10589254_0-1698952429844.png

Is this number only available in the ChangeRequest2 table? 
If so, how can it be linked to Work Item?

TIA!

 

 

11 REPLIES 11

Hello,

 

The 'Work Item' task is linked to its subject via the 'Primary Business Object' join.  So you are correct that the 'Number' of the Change Request does not exist on the 'Work Item'.  You would have to introduce the 'Change Request' table into the query and connect with that join.  You can then include the 'Number' field of the Change Request in your 'Select' definition.  Depending on your situation you may or may not desire an outer join so that Change Requests without any Work Items show up in the result.  Here are some helpful links:

 

Tables and Joins from WHC: https://support.ptc.com/help/windchill/whc/whc_en/#page/Windchill_Help_Center%2FQBTablesAndJoinsAdd.html%23 

 

Generally awesome resource for query builder scenarios: Resource for reporting - PTC Community

 

Specific entry in above resouce page related to work items, voting, and primary business objects.  This example does have the join that I've described and much more to help you get started: https://www.ptc.com/en/support/article/CS130932 

Thanks for the information @aaronjlarson

Do you know if there is a parent table that is over the various types of tasks (like 'Primary Business Object' is for 'Work Item') that could also contain this number, instead of needing to get every task types table? I am being asked to create a column for this "task number" for all types of tasks not just Change Requests. 

Hi @mariaSutton 

So you can use condition if the primaryBusObj instance of WTPart or EPMDoc, or Change Tassk, or Change Order and get the value from that object.. 

You always needs to retype the primaryBusinessObject to correct type if you want to work with them..

 

PS> there is not general table for primaryBusinessObject - this object can be any object in the system and each object type usually has own table and APIs.

There are several type groups as Persistable that can be used on most of the object types. 

 

PetrH

Hi @HelesicPetr ,
Sorry I dont think I am follow.
Are you saying all task types (ie Change Order, Change Request, etc) have the parent of 'Primary Business Object'? 
If so, how can I implement this to obtain the number associated with the task/change object? 
Thanks, 
Maria

Hi @mariaSutton 

 

Workflow task is just one type. The task is connected to the PrimaryBusinessObject that can be almost "any" object in the system.

 

In the workflow PrimaryBusinessObject is also variable where you can find many sub class types as  Change Order, Change Request, etc. but usually one workflow is used for one specific object type. 

 

Here is example for more change object type workflows

//change activity
wt.change2.WTChangeActivity2 thisActivity = (wt.change2.WTChangeActivity2) primaryBusinessObject;
String number = thisActivity.getNumber();

//change order
wt.change2.WTChangeOrder2 changeOrder = wt.change2.WTChangeOrder2)primaryBusinessObject;
String number = changeOrder.getNumber();

//change ChangeRequest
wt.change2.WTChangeRequest2 changeRequest2 = (wt.change2.WTChangeRequest2)primaryBusinessObject;
String number = changeRequest2.getNumber();

 

PetrH

rleir
17-Peridot
(To:mariaSutton)

Maria

Change Request, Change Notice, Problem Report and others are all subtypes of the Change Issue type.  In QB, you can link a Work Item table to a Change Issue table. 

cheers -- Rick

@HelesicPetr is correct.  There is no parent object that can be used.  The 'Primary Business Object' is not a type, per se, that can be used to build a query and return information about all potential objects that can be routed through a workflow.  Depending on what data you need, maybe this approach can work for you.  I've used this for first pass yield reporting.  Rather than try and get all the actual types that represent the PBOs - just focus on the voting and work items.  If you're interested in the result of votes (i.e. Workflow task has been completed) you can introduce the table like in the image below.

 

aaronjlarson_0-1699553922595.png

Then to get the Number of the object you can just pull the calculated attribute of the PBO's Identity through from the Work Item directly, as shown below.

 

aaronjlarson_1-1699553957895.png

This works if A) you don't need to know about tasks that are potential or accepted (i.e. not completed) and B) if you don't need to input criteria into your report based on the PBO Identity.

 

If either of those things are needed then you would have to pull in all of various PBO tables into the report design and using a concatention function you can represent a single column for 'number' and show the number from the applicable PBO type in that row.  This is more advanced.

 

@aaronjlarson Thanks for your detailed explanation. Super helpful!
I will be needing all tasks, so potential, accepted and completed. And there is a "nice to have" request to be able to search by the 'number'.
I would like to try the concatenation function approach. Can you elaborate how this can be done? 

Also, do you think it would help/simplify to make a mini report to collect the 'number' in and them combine it will the report I am working on?

rleir
17-Peridot
(To:mariaSutton)

rleir_0-1699883714287.png

---

rleir_1-1699883768703.png

---

rleir_2-1699883821934.png

Yes, the Primary Business Object can be used with ChangeIssues to see all Variances and PR's in your workflows.

---

A different case: link CR's to Work Items. Remove the ChangeIssue above, and link to ChangeRequest instead

rleir_3-1699884935196.png

---

rleir_4-1699885009891.png

This shows every CR that is involved with a  workflow. Likewise you could link with ChangeActivity 

Hi @rleir & @aaronjlarson

 

Would your approaches work to include the displayIdentifier for the following Change Objects?

  1. Change Request
  2. Change Notice
  3. Problem Report
  4. Promotion Request Variance
  5. Review

The report will need to display the displayIdentifier for each of these in a single column.

I think maybe you're after something like below which is from https://www.ptc.com/en/support/article/CS294349 (I added the User table so I could quick filter to a test data sample).  You can see that the 'change number' appears in a single column regardless of object type, i.e. it shows CR, CN, CA, etc.  Within that function if you want to build out additional information in the string such as "[Number], [Description]" you can use Concatenate within the Null function arguments to include the additional information beyond the number.  This solution also allows you to integrate the Promotion Requests because it is not specific to "Change Issues" or object types related to "change" only. I have done this and tested and it works.  You can continue to layer in as many 'Null value' functions as you need.

aaronjlarson_1-1702488023747.png

 

 

Top Tags