Want to order by at run time?but problem is this that i have 2 different datatypes [message #205271] |
Fri, 24 November 2006 02:13 |
gladiator
Messages: 21 Registered: April 2006 Location: Lahore, Pakistan
|
Junior Member |
|
|
Hi Dears,
I have a report with group above latyout. and in parent group i have 2 fields vendor_name and vendor_id, i want to sort the report at run time, user will select the option on which he wana sort it.
Now the problem is this that order by is not working in the query, the column that is placed at the top in parent group layout report is automatically sorted at that column.
I used the decode option to select the column at run time but decode set the datatype of all columns to the 1st column in decode e.g
decode(:user_option,'ven_name',vendor_name,vendor_id) as order
In above case the datatype of vendor_id is also converted to character.
and when i take vendor_id 1st in decode like folowing it sets the datatype of decode to number and tries to converts the vendor_name to number and if vendor_name is returned from decode it gives error.
I also try to use the CASE WHEN statement but it also dont allow to use different datatypes.
If any one have the solution/workaround, Please reply me.
MANY MANY THANKS FOR YOUR PRECIOUS TIME.
BEST REGARDS,
USMAN.
|
|
|
|
|
|
|
|
Re: Want to order by at run time?but problem is this that i have 2 different datatypes [message #206517 is a reply to message #206281] |
Thu, 30 November 2006 07:17 |
ab_trivedi
Messages: 460 Registered: August 2006 Location: Pune, India
|
Senior Member |
|
|
hi usman,
sending you another rdf file as attachment. i tried your an come to the conclsion that:
1) If you will not take more than one group then you can order by on more than one columns i.e order by ename, order by sal, order by empno etc.
2) But when you will take more than 1 group then only the first column in the group can only be ordered in the report . So it is not correct that only order by ename is happenong if you move empno above then order by empno is possible.
I am sending you another version of rdf ... see it and if you found any solution then return to me. I will also try ...
bye
Ashu
|
|
|
|
|
|