Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the CollectiveAccess support forum! Here the developers and community answer questions related to use of the software. Please include the following information in every new issue posted here:

  1. Version of the software that is used, along with browser and version

  2. If the issue pertains to Providence, Pawtucket or both

  3. What steps you’ve taken to try to resolve the issue

  4. Screenshots demonstrating the issue

  5. The relevant sections of your installation profile or configuration including the codes and settings defined for your local elements.


If your question pertains to data import or export, please also include:

  1. Data sample

  2. Your mapping


Answers may be delayed for posts that do not include sufficient information.

relationship metadata

Hey, I have made metadata field especially for ca_objects_x_occurrences relationship. And the small edit icon appears when setting relationship record in providence. I can edit it and put a different text to a different relationship records.
The problem is when I want to show the metadata text in the object detail page, it shows the same last added text next to each related occurrence. 

The code is like this:

print "<div>".(($this->request->config->get('allow_detail_for_ca_occurrences')) ? caNavLink($this->request, $va_info["label"], '', 'Detail', 'Occurrence', 'Show', array('occurrence_id' => $vn_rel_occurrence_id)) : $va_info["label"])."</div>";
        if($x=$t_object->get('ca_objects_x_occurrences.nr_relationship')){
if($x)print $x;
         }

Thanks

Comments

  • edited April 2016
    I'm assuming you're looping through the occurrences here -- so you should pull the relationship attribute relative to whatever occurrence is being referenced in the current loop. There are multiple ways to do that, but the easiest is probably a display template with one or two nested units. See here: http://docs.collectiveaccess.org/wiki/Display_Templates#Formatting_templates_with_.3Cunit.3E (this assumes you're running Pawtucket2 -- I don't think the latest display template parser has made it into Pawtucket1 yet)
  • Ok, In providence in user interface in Object standard editor in Related Occurrences in
    Relationship display template  I wrote:

    <unit relativeTo="ca_occurrences">^ca_occurrences.preferred_labels (Test: ^ca_objects_x_occurrences.nr_relationship)</unit>

    and it works for Providence. Metadata shows up correctly with the title in Providence, but it doesn't show in pawtucket.  How to write it?
    Thank you
  • Hi Kpk,

    If you are running Pawtucket2, the same template will work.  This syntax is not supported on Pawtucket1.
Sign In or Register to comment.