Formatwiki in table transformer- New row created with zeros
Asked by Karthika_Natarajan:

I used formatwiki in table transformer query where I do a sum operation to list the values of the column. My result query has a new row with zeros. How to trim this new row? or How to avoid it?

FORMATWIKI(SUM('Test' + "\\n")) AS 'Test ',

![Formatwiki issue.png](/t5/image/serverpage/image-id/188184iF11A97BFC43A3B39/image-size/large?v=v2&px=999 "Formatwiki issue.png")


Answers:
author: Katerina Kovriga {Stiltsoft}
body: Hi [@Karthika_Natarajan](/t5/user/viewprofilepage/user-id/4730609) ,

Please give us the full screenshot of the source table and the full SQL query you are using to help with the issue.


author: Karthika_Natarajan
body: Sure [@Katerina Kovriga {Stiltsoft}](/t5/user/viewprofilepage/user-id/1464746) ,Thank you.


author: Katerina Kovriga {Stiltsoft}
body: I've tried to reproduce the issue (maybe a little bit simplified, but the structure looks similar to yours):

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

SELECT  
FORMATWIKI(SUM('Total' + "\\n")) AS 'Total New'  
FROM  
(SELECT  
CASE  
WHEN 'RN' IN (1,5,9)  
THEN "P1"  
WHEN 'RN' IN (2,6,10)  
THEN "P2"  
WHEN 'RN' IN (3,7,11)  
THEN "P3"  
WHEN 'RN' IN (4,8,12)  
THEN 'Total cases'  
END AS 'Priority',  
CASE  
WHEN 'RN' IN (1,2,3,4)  
THEN 'Total' END AS 'Total',  
CASE  
WHEN 'RN' IN (5,6,7,8)  
THEN 'Total' END AS 'To Do',  
CASE  
WHEN 'RN' IN (9,10,11,12)  
THEN 'Total' END AS 'Done'  
FROM  
(SELECT ROWNUM() AS 'RN', 'Total' FROM T\*))

Here is my result:

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

The FORMATWIKI(SUM('Total' + "\\n")) works correctly and the nested SQL queries seem to be fine.

Maybe it will be better to [raise a support ticket](https://jsd.stiltsoft.com/servicedesk/customer/portal/2) where you could attach the original Excel file and the Page Storage Format (upper right corner -\> menu ... -\> View Storage Format). We'll be able to look into your exact page.


author: Karthika_Natarajan
body: This is the excel from where I Extract the source table by transposing it.![Source.png](https://community.atlassian.com/t5/image/serverpage/image-id/188421i4D37483ADBCAFD4E/image-size/large?v=v2&px=999 "Source.png")


author: Katerina Kovriga {Stiltsoft}
body: And may I see the source table? I see from the query that you use plenty of columns where you try to sum up values and on the screenshot I see a noname column with numbers, text and empty cells. It looks like a result column or smth.


author: Karthika_Natarajan
body: This is the source table (Extracted from Excel)  
![Source table.png](https://community.atlassian.com/t5/image/serverpage/image-id/188388iBC84560376C53365/image-size/large?v=v2&px=999 "Source table.png")


author: Karthika_Natarajan
body: Hi [@Katerina Kovriga {Stiltsoft}](/t5/user/viewprofilepage/user-id/1464746)  
Please find the query below

SELECT  
FORMATWIKI("\*P1\*"+"\\n"+"\*P2\*"+"\\n"+"\*P3\*"+"\\n"+"\*Total\*") AS 'Priority',  
FORMATWIKI(SUM('Total' + "\\n")) AS 'Total Cases',  
FORMATWIKI(SUM('Automatable' + "\\n")) AS 'To Do',  
FORMATWIKI(SUM('Automated' + "\\n")) AS 'Done'  
FROM  
(SELECT  
CASE  
WHEN 'RN' IN (1,5,9)  
THEN "P1"  
WHEN 'RN' IN (2,6,10)  
THEN "P2"  
WHEN 'RN' IN (3,7,11)  
THEN "P3"  
WHEN 'RN' IN (4,8,12)  
THEN 'Total cases'  
END AS 'Priority',  
CASE  
WHEN 'RN' IN (1,2,3,4)  
THEN 'Total' END AS 'Total',  
CASE  
WHEN 'RN' IN (5,6,7,8)  
THEN 'Total' END AS 'To Do',  
CASE  
WHEN 'RN' IN (9,10,11,12)  
THEN 'Total' END AS 'Done'  
FROM  
(SELECT ROWNUM() AS 'RN',  
T1.'__' AS 'Total' FROM T1 WHERE T1.'__' NOT IN ("Total")))


Tags: confluence-server

server