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
AUG Leaders

Atlassian Community Events