Is it possible to use both historical value and an if statement in a Structure formula?

Jared August 26, 2022

Hi everyone,

Relatively new to structure, I'm trying to pick up the historical value of a rag status, say a week ago and then display as a coloured panel.

I've had success with both using historical value and coloured panels separately, but when combined it seems to ignore the historical value.

Would anyone be able to advise whether this is possible or where I may be going wrong please?

Formula:

RAG formula in structure.PNG

 

Expected output: 

 

Expected Output.PNG

1 answer

1 accepted

2 votes
Answer accepted
David Niro
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
August 29, 2022

Hello @Jared ,

David from ALM Works here.  Welcome to the Community!

Combining the historical value and the wiki formatting is definitely possible.  I've provided one of the methods below. 

WITH HV_OR = 
IF Issuetype = "Assurance":
historical_value(this,"overallRAGStatus",DATE_SUBTRACT(Now(),7,"day"))
:

WITH FORMAT_CAPTION(value,background)=
"""{panel:bgColor=$background}*$value*{panel}"""
:

IF HV_OR = "Red":
FORMAT_CAPTION("R","#FF0000")
ELSE IF HV_OR = "Amber":
FORMAT_CAPTION("A","#FFBF00")
ELSE IF HV_OR = "Green":
FORMAT_CAPTION("G","#00FF00")

I've created a local variable using WITH HV_OR to identify the historical value of the field (with your parameters) if the issuetype is "Assurance".  

The FORMAT_CAPTION is a user expression that will allow us to quickly format the text and color for the main portion of the formula.

The main formula just compares the HV_OR value against Red, Amber and Green and then assigns the text and color you defined.

Please let me know if it helps, or if there are any adjustments needed.  Look forward to your feedback.

Best Regards,
David

Jared August 30, 2022

That works perfectly, thanks very much @David Niro

I'm still familiarising myself with the Expr syntax so it's good to see a working example. 

Like David Niro likes this
David Niro
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
August 30, 2022

You're very welcome!  Glad to hear it helped!!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events