Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Transpose two column in BIRT Report
tamal24
<p>Hi,</p><p> </p><p>I am newbie in BIRT. I have following scneraio. I have one resultset as following as a query result in transaction table :</p><p>uploadid | subuploadid| stage| description are the column names from transaction table:</p><p> </p><p>uploadid | subuploadid | stage| description</p><p>
</p><p>1 | 2 | CON | xyz,klu</p><p>1 | 2 | STR | abc,bhg</p><p> </p><p> </p><p>What I want in BIRT report is following :</p><p> </p><p>uploadid | subuploadid | CON description | STR description</p><p>
</p><p>1 | 2 | xyz,klu | abc,bhg</p><p> </p><p>is this possible in BIRT ?</p><p>Please somebody help me</p>
Find more posts tagged with
Comments
Hans_vd
<p>Did you try creating an aggregation with the CONCATENATE function?</p>
tamal24
<p>Hi,</p><p> </p><p>Thanks for the reply.</p><p>Actually <strong>,(comma)</strong> seperated description is generated through group_concat() function in MySQL only by grouping the stage column. </p><p> </p><p>And in this case, stage value would be either CON or STR only. upload and subuploadid is variable so is the description.</p><p> </p><p>My existing query :</p><p> </p><p>SELECT STAGE,
CASE err.STAGE
WHEN "STR" THEN
GROUP_CONCAT(description SEPARATOR ',')
WHEN "CON" THEN
GROUP_CONCAT(description SEPARATOR ',')
END AS ERROR_DESC
FROM Error err</p><p> </p><p>Now as the CON and STR values are constant, I want them in two seperate column instead of seperate row for a particular upload and subuploadid..</p>
Hans_vd
<p>I'm not a MySQL specialist, but what if you write this query:</p><pre class="_prettyXprint">SELECT UPLOADID, SUBUPLOADID, CASE err.STAGE WHEN "STR" THEN GROUP_CONCAT(description SEPARATOR ',') END AS STR, CASE err.STAGE WHEN "CON" THEN GROUP_CONCAT(description SEPARATOR ',') END AS CONFROM Error err</pre>
tamal24
<p>Hi Hans,</p><p> </p><p>Thanks a lot for the reply. If I ran your query the result is following :</p><p> </p><p>uploadid | subuploadid | STR | CON</p><p>
</p><p>1 | 2 | NULL | abc,bhg,xyz,klu</p><p> </p><p>The query is appending STR related description with CON description and showing it under CON related column.</p><p> </p><p>Thanks a lot again for helping me.</p>
Hans_vd
<p>I didn't look good enough to your table design, try this:</p><pre class="_prettyXprint">SELECT UPLOADID, SUBUPLOADID, CASE err.STAGE WHEN "STR" THEN description END AS STR, CASE err.STAGE WHEN "CON" THEN description END AS CONFROM Error err</pre>