Jira Issues macro - Issue Type as text
Asked by David_Bakkers:

When using the Jira Issues macro in Confluence, the value returned for the issue Type field isn't text, it's the icon for that issue type:

![Jira Issue - Type value.PNG](/t5/image/serverpage/image-id/92156i34D51A9118E18004/image-size/large?v=v2&px=999 "Jira Issue - Type value.PNG")

Is there a way to return the text value of the Issue Type, like 'Story', 'Epic', 'Risk' etc?

When exporting the table to a CSV, the Type column is always empty. Also, when using third party charting or filtering macros, the icon has no meaning to be used for text filtering or charting.

There's [feature request JRASERVER-60945](https://jira.atlassian.com/browse/JRASERVER-60945 "JRASERVER-60945") for being able to return the Issue Type as text, not an icon, using JQL.... but it's been in 'gathering interest' state since 2016!


Answers:
author: Dominic Lagger
body: Hi [@David_Bakkers](/t5/user/viewprofilepage/user-id/3656527)

I think, the problem isn't the JIRA Issue macro. The problem is in JIRA itself. Because there, it's also not possible to get the item type as a text.

And for both products, I'm not aware, this is possible.

The only workaround would be a custom field in JIRA, with is dependent of the issue tpye field.

Regards, Dominic

comments: author: David_Bakkers
body: I have a solution. Well, for Confluence anyhow.

If you have the *Stiltsoft Table Filter and Charts for Confluence* app, you can use the [Table Transformer macro](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Table+Transformer+macro) to parse the contents of the 'T' column in the Jira Issues macro's table, find each instance of the issue type and convert it into a new column called 'Type'

Here is the SQL to use in the Table Transformer macro:

```
SELECT
? 'T',
? CASE
??? WHEN
????? 'T' = "Epic"
??? THEN
????? "Epic"
??? WHEN
????? 'T' = "Story"
??? THEN
????? "Story"
    WHEN
      'T' = "Sub-task"
    THEN
      "Sub-task"
? END
? as 'Type',
  *
FROM
? T1
```

(Add in any extra WHEN / THEN cases to cover all the issue types in your project or what you're expecting Jira to return)

Here is an example of a resulting table:

![Jira Issue - Type conversion.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/92223i4FD37DEEB60C93E1/image-size/large?v=v2&px=999 "Jira Issue - Type conversion.PNG")

Presto! The issue types as text.


author: Andrey Khaneev _StiltSoft_
body: Hi David,

The query can be simplified to

```
SELECT 'T' 'Type' FROM T1
```


author: David_Bakkers
body: Hello Andrey

I tried that simplified query, but the resulting table only had one column, 'Type'.

I found I still had to select the other columns to add, like this:

```
SELECT 'T' 'Type', 'Summary', 'Status', 'Test Result' FROM T1
```

This also excluded the source 'T' column from the resulting table.


author: Dominic Lagger
body: Hi [@David_Bakkers](/t5/user/viewprofilepage/user-id/3656527)

This is awesome! Nice one! Thanks for sharing your solution!


author: Jacob Jung
body: Hi [@David_Bakkers](/t5/user/viewprofilepage/user-id/3656527) and [@Dominic Lagger](/t5/user/viewprofilepage/user-id/601600)

I know this is a little late to the party, but this is the work around I found. I came across this post as I needed to compare the issue type against other content that is string based.

Thank you for sparking the idea with your post! If we can compare column 'T' with text, then there is text already there. Confluence is likely modifying the format once it hits the table and could be why we see the picture.

The work around I found was to simply cast the column to remove the additional post processing.

For the following examples, an issue type of Task is used. This would be at the same level as a Story.

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/285944iDB824E312970CC3D/image-dimensions/195x31?v=v2 "image.png")

**Casting**

*** ** * ** ***

Straight inline cast to string using VARCHAR()

```
SELECT
   T1.'T' AS T,
? ?CAST( T1.'T' AS VARCHAR(64)) AS 'Type'
FROM T1
```

#### **Output** {#toc-hId-286739574}

The 'Type' cell will then contain plain text ***Task***

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

**Casting with Hyper Link**

*** ** * ** ***

If you would like to keep the issue hyper link that the originally comes with the picture of 'T' in the same cell. It can be re-inserted with FORMATWIKI.

*Where the '_______' is your cloud instance.*

```
DECLARE @var_url AS VARCHAR(64) = "https://_______.atlassian.net/browse/";

SELECT
   T1.'T' AS T,
   FORMATWIKI("[" + CAST(T1.'T' AS VARCHAR(64)) + "|" + CONCAT(@var_url + T1.'Key') + "]") AS 'Type'
FROM T1
```

#### **Output** {#toc-hId--1520714889}

The 'Type' cell will then contain hyper linked text ***Task***to the associated Jira issue.

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

All the best.


Tags: confluence-server

filter

macro

server

table