Table Transformer with Jira Status merged
Asked by Aur?lien Thazet:

Hello everyone,

I'm using Jira Issues to retrieve some issues of a Jira Project and create a schedule in Confluence thanks to Table Transformer. Here is the current display I have:

![table.png](https://community.atlassian.com/t5/image/serverpage/image-id/326114iA40B05FCF6878DE5/image-size/large?v=v2&px=999 "table.png")

Here is my current SQL request:

```
SELECT T1.'Fix Versions' AS 'Version',
CONCAT_VIEW_AGGR(FORMATWIKI('Summary' , " \n")) AS 'Milestone',
CONCAT_VIEW_AGGR(FORMATWIKI('Start date' , " \n")) AS 'Start Date',
CONCAT_VIEW_AGGR(FORMATWIKI('Due' , " \n")) AS 'Due Date',
CONCAT_VIEW_AGGR(FORMATWIKI('Status')) AS 'Status'
FROM T*
GROUP BY T1.'Fix Versions'
```

I would like to display only one value per Version line in the Status column. For example with the first version of the table: I want to display a status message named "COMPLETED" in the status cell because each issue status for this version is Done, Failed or Not applicable.

Any advice on how I can do this can of things ?


Answers:
author: Stiltsoft support
body: Hi [@Aur?lien Thazet](/t5/user/viewprofilepage/user-id/5373148) ,

You may try to insert another Table Transformer macro on top and use the CASE WHEN statement: <https://docs.stiltsoft.com/tfac/cloud/custom-transformation-use-cases-with-advanced-sql-queries-42241587.html#CustomTransformationusecaseswithadvancedSQLqueries-UsingIf/Thenconstruct>

For example, if you have "To do", "In progress", "Done", "Failed" or "Not applicable" statuses, you may start with the checking if the cell contains the "To do" status. If yes, then you put the "Needs work" status.

Then you check for the "In progress" status and set the "Current work" status.

Other statuses that mean "Completed" go to the ELSE part.

SELECT \*,  
CASE WHEN 'Status' LIKE "%To do%"  
THEN "Needs work"  
WHEN 'Status' LIKE "%In progress%"  
THEN "Current work"  
ELSE "Done"  
END  
AS 'Overall Status'  
FROM T1

![Mon 10-1.png](https://community.atlassian.com/t5/image/serverpage/image-id/326130i2981D3764DB687D3/image-size/large?v=v2&px=999 "Mon 10-1.png")

Hope it helps your case.

comments: author: Stiltsoft support
body: Hi [@Aur?lien Thazet](/t5/user/viewprofilepage/user-id/5373148) ,

An update from our developers: if all Done, Failed or Not applicable make COMPLETED and any other status makes INCOMPLETE, you may combine your first query and the second query in one Table Transformer macro:

![Mon 11-1.png](https://community.atlassian.com/t5/image/serverpage/image-id/326136iFCF685D66DC08586/image-size/large?v=v2&px=999 "Mon 11-1.png")

SELECT T1.'Version',  
CONCAT_VIEW_AGGR(FORMATWIKI('Date' , " \\n")) AS 'Date',  
CONCAT_VIEW_AGGR(FORMATWIKI('Status' , " \\n")) AS 'Status',  
IF(SUM(  
IF('Status' = "Done" OR 'Status' = "Fail" OR 'Status' = "Not applicable", 0, 1)) = 0,  
"COMPLETED", "INCOMPLETE") AS 'Overall Status'  
FROM T\*  
GROUP BY T1.'Version'

![Mon 11-2.png](https://community.atlassian.com/t5/image/serverpage/image-id/326137iD1B6B52FC653A4EC/image-size/large?v=v2&px=999 "Mon 11-2.png")

The variant

SELECT T1.'Version',  
CONCAT_VIEW_AGGR(FORMATWIKI('Date' , " \\n")) AS 'Date',  
CONCAT_VIEW_AGGR(FORMATWIKI('Status' , " \\n")) AS 'Status',  
IF(SUM(  
IF('Status' IN ("Done", "Fail", "Not applicable")), 0, 1) = 0,  
"COMPLETED", "INCOMPLETE") AS 'Overall Status'  
FROM T\*  
GROUP BY T1.'Version'

is even slightly shorter but gives the same result (the IF function was rewritten in a more elegant way).


author: Aur?lien Thazet
body: Hello,

I spent a whole day trying to find a solution. It works like a charm, thank you very much!


author: Stiltsoft support
body: Glad it helped your case!

If you have any questions regarding our macros (not Confluence in general but the macros provided by the Table Filter, Charts \& Spreadsheets for Confluence app), you may refer directly to our [support portal](https://stiltsoft.atlassian.net/servicedesk/customer/portal/14).

It is confidential and we can't miss any tickets there (in the Atlassian Community we manually search for relevant posts but maybe some of them are missed).


Tags: cloud

confluence-cloud

filter

table

table-filter

table-filter-and-charts

table-filter-charts-spreadsheets

table-transformer