Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Report is based on Query A (on Item Type A). I want to create a computed field that looks up a value in a related item in Item Type B. I'm thinking I must use one of the External Information Query functions, but I'm not sure. Item Type A is a parent to Item Type B. I could create Query B on Item Type B to return the one and only Item B per Item A that would return the value I seek. (Or, I could include all related items per Item A (and use maximum aggregate function) to return the value I seek.) I cannot find additional documentation on (or examples of) "correlation-field", "source-correlation-field" or "target-correlation-field." Please help. Thank you.
Hi Anita,
If Type A has many Type B items related to it, you probably want to use the Aggregate() function with the relationship field linking A to B as the "relationship-field".
The correlation fields work similarly to the edit field screen of a "Query backed Relationship" type field. What they do is take a large query of items and filter it down based on field values on each item type involved.
As an example, lets say that there is an IBPL field backed by Type A. This field is located on Type B.
If you wanted to see on item A which item Bs had selected the value A, you would create a QBR field.
That QBR field would use a query of all Type Bs but filter them by matching the Source field value (field on Type A, usually the ID field) to the Target field value (field on type B, usually the IBPL field).
With that in mind, here is how the correlation fields break down:
"correlation-field" means that both the value of this field on the item of Type A and item of Type B need to match for the item of Type B to be included in the filtered query results
Alternatively, the value of "source-correlation-field" on the item of Type A would need to match the value of "target-correlation-field" on the item of Type B for that item of type B to be included in the filtered query results
If you do not use either of these correlations to filter it, Query() will run against the full query set for every item in your report, giving the same aggregate value for every row. That may or may not be the functionality you are looking for.
I've rambled for quite a bit, but I hope that answers your question.
Matt
Hi Matt, thank you for responding. I read what you wrote, but it hasn't clicked with me yet. I've tabled this for now, but will return to it.