Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

extract current year in Confluence page

Anna
Contributor
June 19, 2024

Hi there,

I have created Confluence page where all issues are grouped by month. 

Jira macro with relative time is used for each month. For example, January will use the query below

issueFunction in linkedIssuesOfRecursiveLimited("project = XXX", 5) AND issuetype = Bug AND status != Cancelled AND resolved >= startOfYear() and resolved < startOfYear(1M)

I need to extract current year to display it in my page title. The whole reason behind this exercise is to have 1 page that will automatically refresh for each new year without need to edit JQL & current Year value. Is there any way to accomplish this in Confluence without any plug ins and manual intervention to edit it on a yearly basis? 

 

Thanking in advance!

1 answer

1 accepted

0 votes
Answer accepted
Nicolas Grossi
Banned
June 19, 2024
Anna
Contributor
June 20, 2024

Hi Nicolas,

Thanks for the link. It looks like there is no way of extracting year dynamically in Confluence unless we use plug ins. I even checked confiForm elements but none of them met my expectations and also during export into pdf the value in confiForm disappears. I don't see any built in solution within Confluence at this moment.

Regards!

Like Nicolas Grossi likes this
Alex Medved _ConfiForms_
Community Champion
June 20, 2024

@Anna 

Could you please help us to understand what disappears from ConfiForms in PDF export? May be we can fix it...

Also, have you considered creating a user macro may be? 

Some ideas: https://wiki.vertuna.com/display/VERTUNA/Show+current+timestamp+on+the+page

Alex

Anna
Contributor
June 20, 2024

Hi Alex,

I inserted ConfiForm Field Definition (Field type = Text) and saved it. Then entered value 2024 in the page and exported in pdf. The entered value is not in pdf. I also noticed that pdf export pulls all values into pdf from dropdown (Field type = Dropdown), however, I am not my concern of these issues at this point.

I found another field type = Formula and tried to use NOW() function there and it doesn't display current time. I was thinking to format the date to get year. Is it possible to use this field just for pure date operation without referencing to any other field? I am not clear from the field description if this doable?

This is what the documentation tells about Formula field (https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Field+Types)

This field type sets the value for the field based on an expression which can reference the record owner as [owner], a record modifier as [modifier]; and any record field as [entry.FIELD_NAME]. Important: this value is calculated every time an entry is updated (and created). See the "Calculated" type if the field should NOT recalculated on each edit. See Supported math operators, formulas and functions.

Alex Medved _ConfiForms_
Community Champion
June 20, 2024

So, in ConfiForms you have definitions and views... with one you can define/configure the form and with other you can view (and of course export) the data collected with the form

Anna
Contributor
June 20, 2024

I don't need any dynamic entries in the form. My question was regarding a standalone field type = Formula. Is it possible to use it to pull current date, for example?

Alex Medved _ConfiForms_
Community Champion
June 23, 2024

There is no such thing as a "standalone field" - each field is part of the form. And in order to show something from the forms you need to save that "something" into the form. Be it the formula field or any other field 

Anna
Contributor
June 24, 2024

Hi Alex,

Finally, I found a very clumsy decision to display the current year through Office Excel macro in which I defined a formula =YEAR(NOW()) in A1 that returns value 2024.

Will this value change when we enter 2025 year or I need to reload the excel book on a yearly basis to get formula calculation updated? 

P.S. I tested Excel macro and it is a snapshot of information. It should be manually updated or reloaded then the value will change. No need to reply. Thanks for support!

Suggest an answer

Log in or Sign up to answer