You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 3
Next »
Using functions to run searches with the projectdoc Toolbox.
This tip shows the use of search functions in queries based on macros of the projectdoc Toolbox for Confluence.
Search functions provide values to pass into searches that are dependent on the context. In this tip you will learn how to refer to the current user and the current date.
Journals
For this short introduction of search functions our use case is journals. Suppose Jane and John want to work together and share their professional journals. Each journal is organized in years and days. Each day is a page in the year journal. Each day page collects events the journal owner wants to remember. Jane and John also use a common set of subjects, categories, and tags to organize their events.
User Function
Suppose Jane and John use the same view on their work. They craft a page with a couple of display tables and some links to sites that are currently interesting for their work. This page should also collect a number of days from the current user's diary.
This is what the Display Table Macro looks like in the macro editor.
Since every page has the user's full name as the value of the Author property, the currentUser
function can be used to render the full name (by the use of the "fn
" argument) and compare it in the search with the property value.
Date Function
Now let's assume that we only want to show the events of the last week.
The Date property stores the date of the day. To make it comparable to match in a search, you need to use the normalized form. Therefore refer to the artificial property Date§.
The date function now refers to the current date. To define a period of one week to now use -1w
(w
for week). If the date of the day is not older than one week, it will be part of the result set.
The Where parameter now has the value of
$<Author>=${currentUser("fn")} AND $<Date§> >= ${now(-1w)}
Summary
This short tip showed the use of two search functions:
- currentUser
- now
These functions allow to define queries that are dependent on the current user and the current date.