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 | 1 | 8 | 9 | ||
DEF | 5 | 6 | 11 |
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.