Sum hierarchical relationships

edited November 17 in General Support

Hello everybody

I don't know if it's possible but I want to see how many objects has related a storage location, vocabulary term or whatever. The problem is, for example, if I have a hierarchical storage location like this:

Location A (has 1 related object)

Location B -> Location B1 (has 2 related objects)

-> Location B2(has 3 related objects)

When i go to Find->Locations and click into Location B, I would like to see the sum of all the child of the location that i've clicked (2 + 3 = 5 in this case).

Comments

  • You can write a template to generate this in the summary of the storage location. Place a template like this in a generic display bundle:

    <unit relativeTo='ca_storage_locations.children' delimiter="<br>" allDescendants="1">

    <ifdef code="ca_objects.preferred_labels">

        ^ca_storage_locations.preferred_labels: ^ca_objects.preferred_labels<br/>

    </ifdef>

    </unit>

  • You can also use something like this to get a list of all artworks in locations below the current location, with deduplication (if an artwork in listed in two sub-locations, it'll only be listed once:

    <unit relativeTo="ca_storage_locations.children" allDescendants="1" aggregateUnique="1"><unit relativeTo="ca_objects">^ca_objects.preferred_labels</unit></unit>  

Sign In or Register to comment.