Forums

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

Removing columns with empty data using table transformer.

emagnun
Contributor
October 17, 2024

My table data is as below which is dynamically generated. How do i check and remove the columns if the contents are empty?

 

Project
Emer
High
Med
Low
T
ABC 18 9
DEF 56 11

1 answer

1 accepted

2 votes
Answer accepted
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.
October 17, 2024

Hi @emagnun ,

If you are talking about the Table Filter, Charts & Spreadsheets for Confluence app and its Table Transformer macro, you may try the following SQL query:

SET @hasValue = (SELECT SUM('Column 1') FROM T1) IS NULL;
IF @hasValue BEGIN
ALTER TABLE T1 DROP COLUMN 'Column 1';
END;
SET @hasValue = (SELECT SUM('Column 2') FROM T1) IS NULL;
IF @hasValue BEGIN
ALTER TABLE T1 DROP COLUMN 'Column 2';
END;
SELECT * FROM T1

The 'Column 1', 'Column 2' and so on are the columns that you need to check.

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, likes for trees, atlassian community, social impact, tree planting campaign, community kudos, atlassian giving, environmental impact, sustainability, likes for good, atlassian social responsibility, community challenge

Make every click count—help us plant 50,000 trees! 🌳

Want to make your everyday Community actions directly contribute to reforestation? The Atlassian Community can achieve this goal by liking a post, attending an ACE, sending your peers kudos, and so much more!

Help us plant more trees
AUG Leaders

Atlassian Community Events