Skip to main content
Dec 16, 2014 8:09 PM UTC
Solved

Dynamic Presentation Based on Relationships

I would like to change what fields are displayed on a presenation based on some of it's relationships. The article below talks about a function RelCount but it doesn't look like I can use it in field computations. The idea would be to create a boolean that checks if RelCount of a relationship is greater than 0. Then set this boolean to the Visible When property on the presentation.

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS150440&posno=1&q=count relationships&nav=ptcproductgroups||integrity||Product+Group||integrity&source=Search

Is there a way to achieve this functionality?

Thanks,

Nolin

    mrumpAnswer
    Dec 17, 2014 9:38 AM UTC

    HI Nolin,

    If you just want to check whether there is any relationship at all, you can use the RelExists(<fieldname>) function

    So the computation for a boolean "hasRelatedItems" field would be

    RelExists(<your relationship fieldname>)?1:0

    This makes the field's value TRUE if there is a realted Items.

    Then you have to set the Relevance Rule for this boolean field, so that it is only shown if the value is TRUE.

    Then you add the "hasRelatedItems" field to your item type, so you it calculated individually.

    Next you edit you type's presentation template and selected the Grid you want to hide and set the "Visible When" property to the name of you boolean field "hasRelatedItems".

    HTH Matthias

    3 replies

    mrumpAnswer
    Dec 17, 2014 9:38 AM UTC

    HI Nolin,

    If you just want to check whether there is any relationship at all, you can use the RelExists(<fieldname>) function

    So the computation for a boolean "hasRelatedItems" field would be

    RelExists(<your relationship fieldname>)?1:0

    This makes the field's value TRUE if there is a realted Items.

    Then you have to set the Relevance Rule for this boolean field, so that it is only shown if the value is TRUE.

    Then you add the "hasRelatedItems" field to your item type, so you it calculated individually.

    Next you edit you type's presentation template and selected the Grid you want to hide and set the "Visible When" property to the name of you boolean field "hasRelatedItems".

    HTH Matthias

    Dec 17, 2014 6:27 PM UTC

    Perfect! Thank you.