Forums

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

Structure Formula - CONCAT function with SUM

Alexander November 9, 2022

Hi,

i just want to concatenate the string "h" to a sum, but it concatenates the string also to rows without a value, so you just see the "h" in the column;

in the user documentation it is written that falsy values are ignored by concat?

my formula:

sum{ IF IssueType = "Maintenance" : sum{ IF TODAY() < Finishdate AND TODAY() > Startdate : WITH Effort = sum{IF IssueType = "Period" : ROUND(CALENDAR_HOURS(OriginalEstimate))} : Effort } } CONCAT " h"

Output:

344h
234h
h
h
434h

 

Regards,

Alex

2 answers

0 votes
Alexander November 14, 2022

@David Niro ok, thanks, i made it this way:

WITH varSum =
sum{
IF IssueType = "Maintenance" :
sum{
WITH TodayPlus1Year = DATE_ADD(TODAY(),1,"year") :
IF TodayPlus1Year < Finishdate AND TodayPlus1Year > Startdate :
WITH Effort = sum{IF IssueType = "Period" : ROUND(CALENDAR_HOURS(OriginalEstimate))} :
Effort
}
} : IF DEFINED(varSum) : CONCAT(varSum; " h") 

for me, used to "higher" languages like C#, it is difficult from the syntax to define variables and so on in Expr languange;

0 votes
David Niro
Atlassian Partner
November 9, 2022

Hello @Alexander ,

You will need to add a conditional statement that uses CONCAT only when the value of your calculation is != undefined .

The "h" is a text value, which is always going to be truthy.  You see only the "h" because since the calculation is falsy, it is being ignored.

Please let me know if this helps.

Best,
David

Suggest an answer

Log in or Sign up to answer