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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Translate the entire conversation x

Query Builder: How to get business object information from workflow process

Juha_Kokko
11-Garnet

Query Builder: How to get business object information from workflow process

Version: Windchill 12.0

 

Use Case: I created a query builder report for reporting duration of workflow processes in a container. The result looks like this:

 

WF Name | Business Obj Reference 1 | Actual Start | Actual Finish | Context (containerName) | Duration (days)

Part Release Workflow/0000269655 | VR:wt.part.WTPart:1089377814 | 2021-04-16 08:34 CEST | 2021-04-19 08:13 CEST | DRG9016 | 2.99 I would want to extend the report with WTPart information like "Name".


Description:

 

There seems to be no usable "join" between the tables.

I am assuming that i must match business object reference with WTPart "branch identifier",
However: business object reference is a string like "VR:wt.part.WTPart:1089377814" and branch identifier is an integer like "1089377814" from above.

 

I tried to define additional "Criteria" matching these two attributes, but I cannot get the match correct.

How can I configure the query builder to fetch the name of the WTPart?

 

ACCEPTED SOLUTION

Accepted Solutions
aaronjlarson
14-Alexandrite
(To:Juha_Kokko)

Here's a couple solutions.  For your solution to parse the number from that full value use the Sub String function.

Sub String
This string function returns the portion of string expression specified by the start and length numeric expressions.
Takes a string expression as the first parameter, a start numeric expression as the second parameter, and a length numeric expression as the third parameter.
SUB_STRING
SUBSTR
SUBSTRING
Sub String('Windchill', 3, 2) returns 'nd'

 

Sub String (Business Obj Reference 1, 18, 10) will return '6117884855'.  This works because the prefix before the number is always the same and 18 characters long and the number itself will always be 10 characters long.  So basically this parses the full value by starting at the 18th character and returning only next 10 characters.  So in the actual query builder set up for the function plug in the reportable column 'Business Obj Reference 1' as the first argument, then the number constant 18 as the second argument, then the number constant 10 as the third argument.

 

Now - to properly use the data model to do this reference the following CS article: https://www.ptc.com/en/support/article/CS153902 

Specifically this section I've circled.  It translates to the table & join setup below.  What you'll notice is that the link between the Workflow Process and Control Branch is further explained in the post it note.  The businessObjReference value from the Workflow Process is "stored" in the Control Branch table's ID2A2 column, which equates to the Persist Info.Object Identifier.Id in query builder tables, however, in the Control Branch table it doesn't include the type prefix.  In your case 'VR:wt.part.WTPart:'.  And if you try to make a join between them you'll see there is no 'businessObjReference' join type you can use.  

aaronjlarson_0-1742564380484.png

 

To get around this I simply put in a criteria that says the Control Branch OID, plus the type prefix, must equal the 'Business Obj Reference 1' column value from the workflow process.

aaronjlarson_1-1742564705334.png

When you run this report then it pull the part data no problem.  It does return duplicate rows (one for the part result and one for the Workflow Process result so I'd say you have to tick the box for "Distinct" on the report properties page.  I hadn't figured out a way to have it return only one row without using Distinct, but hey close enough for free help I'd say.  I did try setting the Part Latest Iteration = True/Yes/1 but that didn't affect it.  I think it really is just because you're returning results from two different tables that don't actually have a Join between them.

aaronjlarson_2-1742564952097.png

 

View solution in original post

5 REPLIES 5
aaronjlarson
14-Alexandrite
(To:Juha_Kokko)

Seems you've captured the Object Identifier, OID, of the part here: VR:wt.part.WTPart:1089377814.

 

The Branch Identifier is a sub-set of information within the Part that is the unique identifier for the revision branch.  Each revision branch has its own branch identifier.  So you need to join the OID from the workflow's primary business object (PBO) to the WT part but then filter the WT part result by the branch identifier to get the exact revision being referenced in the workflow.  The latter typically done via a subselect, e.g. get me all wtPart where OID = OID from workflow and Branch ID = Branch ID from workflow.

businessobjectreference.png

cad126bc-b3aa-48de-9494-29550ddb4aa2.png

As in the picture above left, business object reference is the only reference to the primary business object on workflow process. It seems to contain a version reference to last iteration. On the right is the sample result of the query - and When I use this BO Ref from the table in Windchill Part Details URL as oid-parameter, the last iteration of the WTpart is displayed.

 wtpart_criteria.pngwtpart_result.png

I my second test, verifying my approach, I am using using the BO reference 6117884855 from my first report as branch identifier parameter of the query and limiting the result to last iteration. This works well and displays the information that I would like to show in the first report!

 

I am not able create a query report, which combines these two reports, because of the format difference of the primary object reference and the branch id. I am trying with the offered java string methods and database functions to separate the number, but not getting it correct.

aaronjlarson
14-Alexandrite
(To:Juha_Kokko)

Here's a couple solutions.  For your solution to parse the number from that full value use the Sub String function.

Sub String
This string function returns the portion of string expression specified by the start and length numeric expressions.
Takes a string expression as the first parameter, a start numeric expression as the second parameter, and a length numeric expression as the third parameter.
SUB_STRING
SUBSTR
SUBSTRING
Sub String('Windchill', 3, 2) returns 'nd'

 

Sub String (Business Obj Reference 1, 18, 10) will return '6117884855'.  This works because the prefix before the number is always the same and 18 characters long and the number itself will always be 10 characters long.  So basically this parses the full value by starting at the 18th character and returning only next 10 characters.  So in the actual query builder set up for the function plug in the reportable column 'Business Obj Reference 1' as the first argument, then the number constant 18 as the second argument, then the number constant 10 as the third argument.

 

Now - to properly use the data model to do this reference the following CS article: https://www.ptc.com/en/support/article/CS153902 

Specifically this section I've circled.  It translates to the table & join setup below.  What you'll notice is that the link between the Workflow Process and Control Branch is further explained in the post it note.  The businessObjReference value from the Workflow Process is "stored" in the Control Branch table's ID2A2 column, which equates to the Persist Info.Object Identifier.Id in query builder tables, however, in the Control Branch table it doesn't include the type prefix.  In your case 'VR:wt.part.WTPart:'.  And if you try to make a join between them you'll see there is no 'businessObjReference' join type you can use.  

aaronjlarson_0-1742564380484.png

 

To get around this I simply put in a criteria that says the Control Branch OID, plus the type prefix, must equal the 'Business Obj Reference 1' column value from the workflow process.

aaronjlarson_1-1742564705334.png

When you run this report then it pull the part data no problem.  It does return duplicate rows (one for the part result and one for the Workflow Process result so I'd say you have to tick the box for "Distinct" on the report properties page.  I hadn't figured out a way to have it return only one row without using Distinct, but hey close enough for free help I'd say.  I did try setting the Part Latest Iteration = True/Yes/1 but that didn't affect it.  I think it really is just because you're returning results from two different tables that don't actually have a Join between them.

aaronjlarson_2-1742564952097.png

 

Thank you for the excellent answer and examples, as well as for providing insights into the workflow-related data model.

I was able to solve my problem with your help — it closely follows my original idea of matching the workflow business object reference to the part branch identifier. Here's my final solution, in case someone else might find it helpful.

 

tables.pngselect.pngconstrain.pngreport_output.png

 

Have you already read this HUB article including several ready-made reports on workflows?

 

[Knowledge Hub] Windchill PLM - Workflows Business Reporting

 

In it you can find also

 

Windchill Data Model for Workflow related objects in Windchill PDMLink

 

 

Marco
Announcements

Top Tags