I want to make a crystal report from the following view:
I need to make a report with the above view vConsolPrchOrd
that looks like:
As you can see this is based on the first 3 Rows in my view vConsolPrchOrd
.
I want to make a crystal report from the following view:
I need to make a report with the above view vConsolPrchOrd
that looks like:
As you can see this is based on the first 3 Rows in my view vConsolPrchOrd
.
After trying a lot i myself found a solution for this, making a crosstab crystalreport
seems not good to me
so i will explain what i have done is:
Installed the additional module tablefunc
which provides the function crosstab(). Since i am PostgreSQL 9.1 i can use CREATE EXTENSION
for that
CREATE EXTENSION tablefunc;
and
converted rows into columns using the following query
select * from crosstab(' select product,branch,orderqty from vConsolPrchOrd ORDER by product ',$$values(1::int),(3),(4),(5),(6)$$) as tbl("product" character varying,"1" numeric,"3" numeric,"4" numeric,"5" numeric,"6" numeric) order by product asc limit 5
BEFORE
AFTER using crosstab