Jump to content
Changes to the Jaspersoft community edition download ×

Multiple values from one column in two different fields


Recommended Posts

Hello,

my column has the following structure

++++++

Value

++++++

A

1

B

2

C

3

 

Now i have two Column Headers and two fields in my Detail Band, like this.

 Header 1     Header 2

$F{Value}      $F{Value}

 

What i try to achieve ist this output.

Header 1    Header 2

A               1

B               2

C               3

 

Is there a way to accomplish this? I tried several things in SQL and the Expression Editor etc. unfortunately nothing worked.

Thank you in Advance.

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

you can try using this sql. I have used Oracle. let me know if you need it in any other database

select header1, header2 from (select decode(mod(rownum/2,1), 0.5, main.id) as  header1,lead(main.id, 1, 0) over (order by rownum) as header2from (select 'A' as id from dual union allselect '1' as id from dual union allselect 'B' as id from dual union allselect '2' as id from  dual union allselect 'C' as id from dual union allselect '3' as id from dual union allselect 'D' as id from dual union allselect '4' as id from dual) main )where header1 is not null[/code]

 

Link to comment
Share on other sites

Thank you for your reply. I tried to transform the code myself fitting for a MySQL database, but i failed.

Could you please help me out?

 

However i think its quite unusual JasperStudio doesn't provide a solution itself, because thats a common 1 to many database with many values associated to one key.

 

In my case:

 

++++++          ++++++

Key                 Value

++++++          ++++++

1                            A

1                           1

2                           B

2                           2

3                           C

3                           3

 

Well i am glad for every explanation, since i'm new to all this stuff.

 

Thanks in advance

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...