Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to use the a user macro to show blog posts based on a specific start date and end date

Bryan Guffey August 12, 2013

Hello all -

I'm attempting to replicate a feature we had in Sharepoint where I could create a news item and set a start date and end date for the item to show up. I'd like to use a variant of the Blog Posts Macro to do so. Basically, the macro should take these inputs:

Title

Body

Start Date

End Date

I should then be able to use the macro to show only the posts where the current date falls within the start and end date range, inclusively.

Any and all help would be great!

5 answers

1 vote
CharlesH
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 5, 2013
Bryan, I haven't used the Zen Foundation plugin myself, but am I right in thinking it helps alter the appearance of pages? It should not change the fact that a blog post is an object able to reported upon by Reporting.
Bryan Guffey September 5, 2013

Charles-

I just realized that it looks like this date filter would only show posts created between two certain dates. Is there a way to set dates this way:

Start: [date] End[date]

the reporting plugin would then show any posts where today's date was between the two dates listed.

0 votes
IT Access March 11, 2016

I've submitted a feature request for this HERE. Please vote on it - I'm surprised Confluence doesn't have this feature that is heavily-used in SharePoint. Hopefully they integrate end date/expiry functionality soon!

0 votes
CharlesH
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 12, 2013

Hi Bryan,

Your code in pastebin looks odd to me - the part with "data:displaystart, data:displayend" in the parameter name "types".

The date filter is normally pretty easy to use. The only thing to remember is that the start and end dates must be expressed in the way described by the format paramater.

Here's an example I just added to an existing report, to pull back pages where the release date value is sometime during 2012:

<ac:macro ac:name="date-filter"><ac:parameter ac:name="minValue">01-JAN-2012</ac:parameter><ac:parameter ac:name="format">dd-MMM-yyyy</ac:parameter><ac:parameter ac:name="maxValue">31-DEC-2012</ac:parameter><ac:default-parameter>data:DateReleased</ac:default-parameter></ac:macro>

If you want to parameterize this in due course that's fine, but I would definitely suggest starting off with hard-coded dates to begin with to make sure the mechanics work. Once achieved, you can then replace the hard-coded values with dynamic values. Are you intending to use injection to do this? I notice you have tried to use this in your pastebin code, but are missing a delimiter (%):

<ac:default-parameter>%global:current date > date:at midnight</ac:default-parameter>

Regards,

Charles

0 votes
Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 5, 2013

Would this fulfill what you are trying to do?

https://marketplace.atlassian.com/plugins/com.atlassian.pas

Bryan Guffey September 8, 2013

Devin, Unfortunately, not. I need this displayed in a page.

0 votes
CharlesH
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 5, 2013

Hi Bryan -

I'm not sure I understand your last question?

The documentation for the date-filter macro includes an example for filtering between 2 given dates, using the minValue and maxValue options. The example I gave earlier also shows these.

If you want to be able to set the min and max dates as parameters in some way, rather than have them hardcoded, then you could do this with the aid of a companion plugin, called Scaffolding. The name might sound strange, but essentially it allows you to build form elements, including text fields, for capturing information. Values captured in this way can be referenced by reporting.

Alternatively, if you were to express your Reporting macros in a user macro, whenever you need to change the dates you could do so in the user macro, and anyone visiting a page where this macro has been included would use the dates you've set.

If you want to delve deeper into the capabilities of Reporting & Scaffolding, you may find this blog post of interest:http://blogs.atlassian.com/2013/01/how-to-building-a-company-glossary-with-confluence/

Regards,

Charles

Bryan Guffey September 8, 2013

Charles - See below - I can't get the report to filter out dates correctly based on today's date and using displaystart and displayend. I could only pul the XML stoarge format, it's here in a pastebin. Thanks!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events