- Created by Robert Reiner, last modified on 05. Apr 2020
projectdoc Toolbox
Using existing properties from other documents.
- Audience
- Type
- Level of Experience
Deep links allow to reference properties on other documents at request time. But deep links are only available for select clauses and on the right side of where constraints. If you need to take information from the result set into account, there is currently no tool in the projectdoc Toolbox for Confluence to support this use case in queries.
For many use cases this situation could be solved by materializing properties from other documents. Materializing means that there is a property for the document that renders a property from another document. This way there is no longer the need for a deep link on the right side of a where clause.
The tools to accomplish this are Display Document Property Ref Macro, its cousin Display Document Property Ref Concat Macro, and the Parent Property Macro.
Update
New Feature in 4.5!
Since version 4.5 there is support to define materalizers by document property controls, space properties, and doctype metadata.
- Materialize by Doctype
- Specify which properties to materialize as artificial properties by doctype.
- mat
- Materialize the controlled property by an artificial property with the given path.
- Doctype Descriptor
- Describes the doctypes model.
Deep Links
A deep link is a reference from one property to the value of another property. Deep links can be used in the Select Clause and on the right side of constraints in the Where Clause.
Select Clause
Suppose there is a Person document with a property Organization
that references an Organization document with information about the corporation the person is working for. If this person document is part of a query result, the following deep link allows to render the organization's website as a column in the table that shows the result.
Organization->Website
Note that the value of the Organization
property needs to be a link to an organisation document. This may be a Confluence link or a link created with a macro from the projectdoc Toolbox, Display Document Property Macro for instance.
More information on using deep links to select on property values in Select Clauses in Display Macros. Besides query macros deep links can also be used in macros that display properties such as Display Document Property Macro or Display Document Properties Macro.
Constraints in Where Clause
If you want to put a constraint on a query, where the type of a person's organization should match the type of organizations in the query result, the following could be used in the Where Clause of a query macro (e.g. Display Table Macro).
$<Type>=[${Organization->Type}]
Suppose you query for documents of type organization
and the query – in form of a Display Table Macro – is part of a document of type person
.
Limitations of Deep Links
What you cannot do is match a property referenced by a property of a document in the result set of a query.
Before 4.5: Deep Links on left side of Constraints are NOT supported!
Without materialization as provided by version 4.5 of the projectdoc Toolbox, the following does not work in the Where clause of a query.
$<Organization->Type>=$[Type]
For this example you want to make sure that the result set contains only persons that work in organizations that match the type of the current document.
If you need this sort of query you need to support this in your information model. To do so you need to materialize this reference in the person document.
Materialization of Property References
Let's take the example from above where we need to select on the type of an organization a person works for. To materialize the property value from another document, the type of the organization in our example, you need to make it a property of the person document.
Property Reference
Assume that the type is NGO, we could add a property "Works for Organization of Type
" and set the string NGO as its value. Better yet, so that changes to the type on the organization document are reflected in the person document, use the Display Document Property Ref Macro.
This way you can use the type of the organization in your queries like this:
$<Works for Organization of Type>=$[Type]
Effectively, the property reference Organization->Type
has been materialized in Works for Organization of Type
.
Parent Property Reference
There is a special form of a property reference to another document which is the Parent Property Macro. Per default this macro is used for the value of the Parent Property in every doctype provided by smartics. You can take advantage of this property to materialize properties from the parent of this document.
Property Reference with Concat
Concat stands for concatenation and this feature is provided by the Display Document Property Ref Concat Macro. This macro does essentially the same as the Display Document Property Ref Macro but allows to add a text string to the property value. This is useful for properties like phone numbers, where the base phone number is specified in the organization document and you need to append the phone number extension to the phone number stem.
Resources
More information on tools and concepts mentioned in this tip.
- Search Tips
- Tips on specifying search queries for Lucene. This also applies to projectdoc's query macros.
- Display Table Macro
- Lists references to projectdoc documents in a table. Allows to select document properties for columns. Also non-list representations are provided.
- Display Document Property Ref Macro
- Displays a document property from a referenced document.
- Display Document Property Ref Concat Macro
- Displays a single property of a document that is referred by a property of another document and concatenates it with the value of a local property.
- Display Document Properties Macro
- Renders a template with property references.
- Display Document Property Macro
- Renders the value of a property of a document.
- Parent Property Macro
- Renders the property of the parent document, if it has the same doctype.
- Document Type
- A document type (doctype) defines the properties and section for document instances. It also provides home and index pages. In Confluence these doctypes are implemented as page blueprints, usually with one template. This template is used to create new pages in Confluence.
- projectdoc Document
- projectdoc is based on projectdoc documents. Creating a projectdoc document is easy: A projectdoc document is a Confluence page using document properties and sections.