Forums

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

Table Transformer Macro: how to remove duplicates attributes in different rows

silvio croce February 27, 2023

Hello,

I need to remove duplicates from a table that I created getting issues from jira using the table transformer macro.

for example if I have a table like this:

 

colun1 | column2 | column3

1          | 2             |3

1          | 2             |4 

5          |  6            | 7

 

Should be transformed into:

 

colun1 | column2 | column3

1          | 2             |3

            |                |4 

5          |  6            | 7

 

Of course I need all of this to be dynamic and not custom to a particular table.

 

Thanks in advance

1 answer

1 accepted

2 votes
Answer accepted
Katerina Rudkovskaya _Stiltsoft_
Atlassian Partner
February 28, 2023

Hi @silvio croce,

The simplest way to aggregate tables is to use the Pivot Table macro:

Tue 19-1.png

Tue 19-2.pngTue 19-3.png

And here is another variant using the Table Transformer macro:

Tue 19-4.png


SELECT 'column1', 'column2',
CONCAT_VIEW_AGGR(FORMATWIKI('column3' , "\n")) AS 'column3'
FROM T*
GROUP BY 'column1', 'column2'


Tue 19-5.png

Hope it helps your case

silvio croce February 28, 2023

Hello  Katherina,

 

thanks for the 2 suggestions, they are both useful! They can make it for my case and I accept your answer. Your answer was very quick thanks again!

just for the sake of my curiosity, is there a way to loop the table taws and empty the cells according to some condition on the previous row?

thanks in advance

Katerina Rudkovskaya _Stiltsoft_
Atlassian Partner
February 28, 2023

Not sure that it is exactly your case, but you'll be able to delete (or change) data from table cells based on this cell's value or based on the value from another cell (but in the same row). You may browse our documentation for the "CASE... WHEN..." examples.

The Table Transformer macro itself is based on the AlaSQL library and treats its source table as a mini SQL database. So we are a little bit limited here.

Like # people like this
silvio croce March 1, 2023

thanks again, I know the CASE WHEN possibility. It is very usefull.

I think you touched the core of my question when you say "but in the same row", I would need "also in the previous row" :-) 

I would need for each column of the table, compare the value of the current row with the one of the previous row, and in case they are identical put a blank value.

This is what I would dream of :-)

 

but thanks again, already the pivot table does a lot of what I need. 

Like Stiltsoft support likes this
Stiltsoft support
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 1, 2023

Hi @silvio croce ,

It seems that aggregating via the Pivot Table macro and grouping via the Table Transformer macro (the GROUP BY option) is the closest touch we have.

The Table Transformer macro also supports the DISTINCT function - maybe it will come in handy for other cases with duplicate entries.

Like silvio croce likes this
silvio croce March 1, 2023

thanks a lot! I'll give it a try.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events