Using derived data to populate a hidden field

40 views
Skip to first unread message

Katie Baigrie

unread,
May 21, 2018, 10:23:29 AM5/21/18
to Hippo Community
I'm looking to populate a hidden field on a document type using derived data in order to index that data for searching. I can successfully populate it with something from within the document itself, but what I require is for it to be populated with a field from a related document. I'm having problems formulating the correct query to get the data I require.

If this is possible, could someone point me in the direction of how to do this? We have a Role which has a single related document pointing to a Person, who is the current role holder.

My derivative definition looks like this - this is working to get populate the field from something from itself:

definitions:
config:
/hippo:configuration/hippo:derivatives/rolePersonData:
jcr:primaryType: hipposys:deriveddefinition
hipposys:classname: scot.gov.www.function.RoleUser
hipposys:nodetype: govscot:Role
hipposys:serialver: 1
/hipposys:accessed:
jcr:primaryType: hipposys:propertyreferences
/personName:
jcr:primaryType: hipposys:resolvepropertyreference
hipposys:relPath:
../{.}/govscot:title
/hipposys:derived:
jcr:primaryType: hipposys:propertyreferences
/incumbentName:
jcr:primaryType: hipposys:relativepropertyreference
hipposys:relPath: govscot:incumbentName

An example of the document and the field I wish to derive is like so. I wish to get the govscot:title file from the govscot:incumbent (Person) to put into govscot:incumbentName:

/a-role:
jcr:primaryType: hippo:handle
jcr:mixinTypes: ['hippo:named', 'mix:referenceable', 'mix:versionable']
jcr:uuid: d4eb6106-742a-4a6f-b1e8-dbfb6a03c208
hippo:name: A Role
/a-role:
jcr:primaryType: govscot:Role
jcr:mixinTypes: ['mix:referenceable']
jcr:uuid: bfafa475-5c60-4447-9199-cc755f3a7fe4
govscot:incumbentName: <Name of the current incumbent here>
govscot:metaDescription: Meta desc of the role
govscot:seoTitle: A role
govscot:summary: A summary of the role.
govscot:title: A Role
hippo:availability: [live, preview]
hippo:name: A Role
hippostd:state: published
hippostd:tags: [role, some_role]
hippostdpubwf:createdBy: som...@gov.scot
hippostdpubwf:creationDate: 2015-09-25T14:36:42+01:00
hippostdpubwf:lastModificationDate: 2017-03-13T13:42:49Z
hippostdpubwf:lastModifiedBy:
som...@gov.scot
hippotranslation:id: f8845846-f0e5-49db-b59f-2ee31acabe59
hippotranslation:locale: en
/govscot:content:
jcr:primaryType: hippostd:html
hippostd:content: |+
<p>Some information on the role</p>

/govscot:notes:
jcr:primaryType: hippostd:html
hippostd:content: ''
/govscot:responsibleRole:
jcr:primaryType: hippo:mirror
hippo:docbase: d4eb6106-742a-4a6f-b1e8-dbfb6a03c208
/govscot:incumbent:
jcr:primaryType: hippo:mirror
hippo:docbase: 0501045d-40fa-4b7e-b6a9-fc37ce38bd70

/govscot:orgRole:
jcr:primaryType: hippo:mirror
hippo:docbase: d4eb6106-742a-4a6f-b1e8-dbfb6a03c208
/govscot:responsibilities:
jcr:primaryType: hippostd:html
hippostd:content: ''

I'm also a little confused between when to use hipposys:relativepropertyreference vs hipposys:resolvepropertyreference and can't find any examples of when it is appropriate to use hipposys:propertyreference or hipposys:builtinpropertyreference.

Thanks in advance,
Katie

Jeroen Hoffman

unread,
May 22, 2018, 4:32:24 AM5/22/18
to hippo-c...@googlegroups.com

Hi Katie,

The derived data was specifically designed to stay in context of the document, so you cannot do queries or traverse outside of it. Perhaps workflow event handling [1] will work better for you, there you have access to a JCR session.

HTH
Jeroen

[1] https://www.onehippo.org/library/concepts/workflow/workflow-events.html

--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages