converting rows to columns

Stimulsoft Ultimate discussion
User avatar
dmasterplan
Posts: 143
Joined: Thu Mar 17, 2022 4:04 am
Location: Philippines

converting rows to columns

Post by dmasterplan »

Hi,

I have this query result:

Code: Select all

     
     TITLE                   CODE
    --------------------------------
    ABCDE-AA-XXX-PD-001		A
    ABCDE-AA-XXX-PD-001		B
    ABCDE-AA-XXX-PD-001		C
    ABCDE-AA-XXX-PD-001		D
    GBSRH-AF-DXY-PD-001		1
    GBSRH-AF-DXY-PD-001		2
    GBSRH-AF-DXY-PD-001		3
    GBSRH-AF-DXY-PD-001		4
    GBSRH-AF-DXY-PD-001		5
    GBSRH-AF-DXY-PD-001		6
I want to change it to:

Code: Select all

    TITLE                   REVISIONS
    -----------------------------------------------------------
    ABCDE-AA-XXX-PD-001	    A      B      C      D 
    GBSRH-AF-DXY-PD-001     1      2      3      4     5     6
I tried this using PIVOT but I can't produce the output since they have different number of columns.

So, I concluded that this can be done in Stimulsoft without using PIVOT since this one that I want to achieve is a Stimulsoft report.

Thanks much!
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: converting rows to columns

Post by Lech Kulikowski »

Hello,

You can use the Cross-Data component for that task.

Thank you.
Attachments
Screenshot 2022-08-11 094202.png
Screenshot 2022-08-11 094202.png (63.61 KiB) Viewed 1796 times
CrossData.mrt
(20.41 KiB) Downloaded 141 times
User avatar
dmasterplan
Posts: 143
Joined: Thu Mar 17, 2022 4:04 am
Location: Philippines

Re: converting rows to columns

Post by dmasterplan »

Thank you for answering my question.

How can I achieve this?
This is what I did. I created two datasources, 1 master and 1 detail.
Both has title and code. Created a relation, parent and child columns are title.

Data 1 and Data 2.
Data2 is the master and Data1 is the detail.

Datasource2 (Data2)
has CrossHeaderBand1 inside is Data2.title
and CrossDataBand1 inside is Data1.code

CrossDataBand1 is the detail and Data2 is the master.

I have achieved I want but the output is duplicate though my query is DISTINCT (used INTERSECT).

What did I do wrong?

Can you please help me with this.

I have attached my report for you to look at.

Thanks much!
Attachments
DrawingsAndRevisions.mrt
(348 KiB) Downloaded 138 times
User avatar
dmasterplan
Posts: 143
Joined: Thu Mar 17, 2022 4:04 am
Location: Philippines

Re: converting rows to columns

Post by dmasterplan »

Please help. I am not getting my target output. I am getting duplicates.
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: converting rows to columns

Post by Lech Kulikowski »

Hello,

In the provided sample is created an additional data source ("Data from other Data Source") that contains only grouped data and is used for master databand.

Thank you.
User avatar
dmasterplan
Posts: 143
Joined: Thu Mar 17, 2022 4:04 am
Location: Philippines

Re: converting rows to columns

Post by dmasterplan »

Thanks for answering.

I actually did group the master datasource BUT I am still getting duplicates.

Please check my screenshots and I will reattach my report file for your review.

Please help as I really need to finish this. My deadline is getting near.

Thanks much!
Attachments
master grouped by.png
master grouped by.png (87.66 KiB) Viewed 1757 times
DrawingsAndRevisions.mrt
(37.5 KiB) Downloaded 135 times
data sources.png
data sources.png (116.23 KiB) Viewed 1757 times
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: converting rows to columns

Post by Lech Kulikowski »

Hello,

Please send us your report with test data for analysis.

Thank you.
User avatar
dmasterplan
Posts: 143
Joined: Thu Mar 17, 2022 4:04 am
Location: Philippines

Re: converting rows to columns

Post by dmasterplan »

Please see attached report file.
Attachments
DrawingsAndRevisions.mrt
(37.5 KiB) Downloaded 127 times
User avatar
dmasterplan
Posts: 143
Joined: Thu Mar 17, 2022 4:04 am
Location: Philippines

Re: converting rows to columns

Post by dmasterplan »

Reattaching report with database.

Please help.

Thanks
Attachments
DrawingsAndRevisions2.mrt
(34.93 KiB) Downloaded 141 times
themasterplan.7z
(196.21 KiB) Downloaded 139 times
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: converting rows to columns

Post by Lech Kulikowski »

Hello,

Please send us test data for your report.

Thank you.
Attachments
Screenshot 2022-08-15 091113.png
Screenshot 2022-08-15 091113.png (48.32 KiB) Viewed 1683 times
Post Reply