Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Section
titleUsing Properties

A variable has a value that may be changed. Document and space property values can also be changed. The following sections show uses cases where the change of a property value is reflected on a page that refers to it.

A property value may be simply be rendered or control what is rendered be used in a number of ways. We will focus on document properties for our examples.

Section
titleProperty Reference

A property may simply be referenced with a Display Document Property Macro. Whenever the value of the property is changed, the value will change in the page using this macro is rendered.Macro editor view to render a property value.

Note Box
titleAllowed as Property Value

The macro can also be used as a property values, since a page gets updated whenever a referenced page is.

There is a number of macros that allows user to render property values.

Tour
header-translationsName=Macro
replace-title-with-nametrue



Authors may also choose to render properties of a list of documents in tabular form using the Tour Macro. Each property is rendered in a column or multiple properties may be rendered in a table cell using a template.


Section
titleControl Rendering Sections

With document and space properties authors can control whether or not to render a section (using the Section Macro) or a region (using the Content Marker Macro) on a page.

Section is shown if the property with name 'Type' has a value of 'Tip'.

Authors may also check for a property for any value (i.e. require the property not to be empty).

Section is shown if the property with name 'Authorized by' is not an empty value.

The use case for the above example would be to show the section only if the document is authorized by a person. The authorization is provided by adding the name of the person who give the authorization.

Caution Box
titleNot a Workflow with role-based protection!

This use case does not protect the authorization process. Any user with write access to a page may alter any property (remove it or change value).



Section
titleList Documents

Document properties can be used to control which documents are shown in dynamic list. The Display List Macro and Display Table Macro provide a parameter named Where to specify queries. A Where clause looks like this:

Where clause to filter on documents.

The following shows the same query but with exact match. While the query above will also match types like "Great Tip" and "Lousy Tip", the query below matches only for "Tip".

Exact match query.

Once the value of a property changes, the query will update the results the next time the page with the dynamic list is rendered.

Tip Box

For date values there is a normalized property to make it easier to match values despite of the formatting. So instead of "Creation Date" authors may want to use "Creation Date§".

Sample with normalized date property value.

In case dates or other property types need to be compared, check out Search Functions on Search Tips or read the tip Search Functions.

The Transclude Documents Macro transcludes sections from documents that are part of a result set. The query is also specified by a Where parameter as shown above.



Section
titleUpdating Property Values

Property values may be updated by editing the value in the properties table inside the Document Properties Marker Macro and saving it.

An alternative way of changing values is to use the Web API of the projectdoc Toolbox which is provided by the free Web API Extension. This way a property can be changed by a simple REST call.

Changing values with this REST API can also be made quite simple from within an author's web browser by the use of bookmarklets. Use the free Bookmarklets Extension to get started with defining your own bookmarklets.

...