User macro - Display current calendar week + n

Konrad Gora March 20, 2023

Hello, 

I try to create user macro which display, as a number, current calendar week + n. 

Where "n" is written in the @ param. 

This is my code: 

## @param Nextcw:title=Calendar week +n |type=int|required=true|desc="n" value
#set ($n = $paramNextcw)
#set($Integer = 0)
#set($Integer= $Integer.parseInt($n))

#set($calendar = $action.dateFormatter.calendar)
#set($cweek= $calendar.get(3)+$Integer)
$cweek

It's working almost good. But the problem is that variable $cweek is an integer. 

I assume that I should convert it to the type "date"? In other way I'll get values above 52.  

But I have no idea how to handle it. I would add that this is my first usermacro. So I'm total newbie. 

 

1 answer

2 votes
Katerina Rudkovskaya _Stiltsoft_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
March 21, 2023

Hi @Konrad Gora,

Please check if your company uses our Table Filter and Charts for Confluence app – the case can be accomplished via its Table Transformer macro.

Tell us if you see the Table Transformer macro among the available macros – we’ll be able to help you with the SQL query.

Konrad Gora March 23, 2023

Hello, 

Thank you for answer. I know solution with Table filter macro but I'm not sure if it is for us. With this app I am limited to display CW only in table. I need more flexible way to show CW. That's why I chose the user macro solution.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events