Pagination along with multiple column stretching
HI Everyone,
To provide column auto adjustment i used columnStretching="multiple" and successfully implemented. But when I'm trying to use Pagination to the tables i'm getting visibility problem i.e. the pagination status message is not being displayed correctly and also page numbers are not displayed if anyone has come across this please help me to achieve dynamic column adjustment along with pagination.
Most references are for either stretch multiple table columns or pagination.
Refer How to equally stretch multiple table columns ....
http://www.oracle.com/technetwork/developer-tools/adf/learnmore/march2011-otn-harvest-351896.pdf
Andrejus Baranovskis's Blog: How To Control ADF Table Pagination on Runtime and Do Case Insensitive Search
Are the two applied together?
Similar Messages
-
Creating Select List with multiple columns
I want to create a select list with multiple columns. I followed the demo application model described in the by Denes Kubicek (Currently my reference for APEX !!)
The code is as follows:
CREATE OR REPLACE FUNCTION getcrops(p_cropid IN NUMBER)
RETURN VARCHAR2
IS
v_cropid VARCHAR2 (400);
v_fcode VARCHAR2 (400);
v_product VARCHAR2 (400);
v_var VARCHAR2 (400);
v_fname VARCHAR2 (400);
v_acres VARCHAR2 (400);
v_style_start VARCHAR2 (400);
v_style_end VARCHAR2 (400);
v_return VARCHAR2 (400);
BEGIN
FOR c IN (select "CROP"."CROPID" as "CROP ID",
"CROP"."FIELDCODE" as "FIELD CODE",
"CARROTPRODUCTLIST"."CARROTPRODUCTNAME" as "PRODUCT",
"VARIETYLIST"."VARIETYNAME" as "VARIETY",
"FIELD"."FIELDNAME" as "FIELD NAME",
"CROP"."SIZEINACRES" as "ACRES"
from "FIELD" "FIELD",
"CARROTPRODUCTLIST" "CARROTPRODUCTLIST",
"VARIETYLIST" "VARIETYLIST",
"CROP" "CROP"
where "CROP"."CARROTPRODUCTTYPE"="CARROTPRODUCTLIST"."CARROTPRODUCTID"
and "CROP"."VARIETYID"="VARIETYLIST"."VARIETYLISTID"
and "CROP"."FIELDID"="FIELD"."FIELDID")
LOOP
v_cropid := TO_CHAR (c.'CROP ID', 'FML999G999G999G999G990');
v_fcode := c.'FIELD CODE';
v_product := c.'PRODUCT';
v_var := c.'VARIETY';
v_fname :=c.'FIELD NAME';
v_acres :=c.'ACRES';
FOR i IN 1 .. 12 - LENGTH (c."CROP ID")
LOOP
v_cropid := v_cropid || ' ';
END LOOP;
FOR i IN 1 .. 12 - LENGTH (c.'FIELD CODE')
LOOP
v_fcode := v_fcode || ' ';
END LOOP;
FOR i IN 1 .. 12 - LENGTH (c.'PRODUCT')
LOOP
v_product := v_product || ' ';
END LOOP;
FOR i IN 1 .. 12 - LENGTH (c.'VARIETY')
LOOP
v_var := v_var || ' ';
END LOOP;
FOR i IN 1 .. 12 - LENGTH (c.'FIELD NAME')
LOOP
v_fname := v_fname || ' ';
END LOOP;
FOR i IN 1 .. 12 - LENGTH (c.'ACRES')
LOOP
v_acres := v_acres || ' ';
END LOOP;
v_return := v_cropid || v_fcode || v_product || v_var || v_fname || v_acres;
END LOOP;
RETURN v_return;
END;
I created this anonymous Pl/SQL function at a application level ..Then I followed up to create a select list with a function inside. However I could not create select list with the command suggested in the demo which is
select getcrops(cropid) d, cropid r from crop;
APEX (2.1) returns a error message. What am I missing ? Should the function be called from somewhere else after creating a regular select list..? Where the functions (Pl/SQL) should be ideally stored for application level access..? and for across application level access ? How can I check the function works good. Help is appreciated.Still really one column.
If they need to be independent then you've got to have three selection lists.
% -
Selection list with multiple columns
How can i create a selection list with multiple columns?
Still really one column.
If they need to be independent then you've got to have three selection lists.
% -
Select list with multiple columns
I want to create a select list with multiple column option. What are the options. Any developments in apex 3.0.1 ? Thanks in advance. I tried the tutorials by Kubicek.
I am kind of stuck to see the function entry inside LOV definition returns a error.Still really one column.
If they need to be independent then you've got to have three selection lists.
% -
hello all ,
how to create a list with multiple columns ? can anyone share some examples or code snippetsWhat I would usually do is create a movieclip/sprite that contains a row with every column in it (each column being a textfield). Then pile up the rows one atop the other (using Actionscript) as they are populated with data.
-
GROUP BY with multiple columns.
I have little query about GROUP BY clause.
Sometimes we will give multiple column names in GROUP BY .If it behaves in the same way as ORDER BY (multiple columns) i would love to have an example where I can use GROUP BY multiple columns. Anyways howsoever it behaves it will be really appreciated if anyone can explain a scenario where GROUP BY with multiple columns can be used.
I know about the usage of aggregate functions with GROUP BY but using only one column.
Thanks..!!!Hi,
Group by is used for grouping of same records. check this bellow scenario
SELECT registrationid, dateofbirth, age FROM prawin62 WHERE registrationid = 22;
22 1/23/1975 54
22 5/18/2011 66
22 5/18/2011 66
22 5/18/2011 66
22 5/18/2011 66
22 5/18/2011 66SELECT registrationid, sum(age) FROM prawin62 WHERE registrationid = 22 GROUP BY registrationid;
22 384SELECT registrationid, dateofbirth, sum(age) FROM prawin62 WHERE registrationid = 22 GROUP BY registrationid, dateofbirth ;
22 5/18/2011 330
22 1/23/1975 54Thanks,
Praveen -
Post Author: vman
CA Forum: General
I am working a report that has had the details section format with multiple columns selected. I want to change the report and remove the check box, but it is grayed out. How can I get the report details section back to default without the detail size constraints?Post Author: rcoleman
CA Forum: General
Bearing in mind that I'm a relative newbie to the report writing/Crystal world...the only thing I can think of is that maybe the report was written using an older version of Crystal and this option wasn't available. Another possibility, if it's a sub-report, you might try making a copy of the sub-report saving it with the same name, deleting the old sub-report, replacing it with the copy you made. I know that has worked for me when I've had problems with the re-import when opening is greyed out. -
Selectively Format Groups with Multiple Columns
I have a bit of an obscure task I've been trying to hammer out to no avail. I've searched quite a bit but can't seem to find anyone else who has attempted this. I have two group by statements, one is a category and the other is a rank. What I'm trying to do is organize the report so that there are category rows and below each category row is a set of columns for each rank with their associated values as such:
category1
rank1 rank2 rank3 rank4
value1 value1 value1 value1
value2 value2 value2 value2
category2
rank1 rank2 rank3
value1 value1 value1
value2 value2 value2
I've tried using details>Section Expert>>Layout>Format Groups with multiple column. Unfortunately, this applies to both groups putting the categories into columns instead of rows, making a mess. Does anyone know of a way to selectively put groups into columns and ensure alignment? In the above example the user would be able to compare rank values from multiple categories since they all line up. Any help with this would be very much appreciated.Hi,
Have you tried using a crosstab? Give this a shot:
1) Group the report on Category
2) Create a new group header section. Group Header b
3) Place a crosstab in this section
4) The columns would be the Rank field, I'm not sure about what you would like to show in the rows
5) The summarized field would be the Value field ofcourse
Let me know how this goes.
-Abhilash -
Repeat "Detail a" section when using "Format with Multiple Columns" layout
I am using Crystal Reports for .NET (VS 2008) and I would like to get the "Detail a" section to repeat at top of a second column containing additional data in "Detail b" section. Please see below for example, specifically "Detail a (2)". Any tips or help much appreciated.
Detail a (1)_____Detail a (2)
Detail b (1-1)___Detail b (2-3)
Detail b (1-2)___Detail b (2-4)
--Detail b (1-3)___Detail a (3)
Detail a (2)______--Detail b (3-1)
--Detail b (2-1)
--Detail b (2-2)
Thx, Scottthe format with multiple columns i dont believe will show you the value 2x, but allows you to display the values across instead of down.
i think you may want to use a sub report -
Treeview with multiple columns
I googled alot about creating a treeview with multiple columns similar to a listview in details mode with the added benefit of nodes and roots. I got some answers but I was wondering if visual 2008 itself has such an option, and if not what is my best
choice?
Debra has a questionI just wanted to know if in the visual studio 2008 itself there is an option to have a multi column treeview or a listview with nodes...
Debra has a question
Hi Debra,
>> a multi column treeview
As far as I know, the standard Microsoft .NET TreeView does not support columns, and if you want a tree control that supports columns, you could turn to the link from Tony:
#TreeView with Columns
http://www.codeproject.com/Articles/23746/TreeView-with-Columns
>>a listview with nodes
I made a research about “a listview with nodes” and found no results. I checked the ListView Class and did not find information about nodes.
Best Regards,
Edward
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a
href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey. -
How to link Excel Chart with multiple columns dynamically?
Hi all,
I have one problem. I have an excel chart which has to read data from multiple columns for it's X-axis values (time stamps) and the same number of values for it's Y-axis from multiple columns. See figure attached.
Now, you can do this by manually assigning values by holding control key to tell the chart that data from many columns is continued from the first column. i.e, a long data is distributed along may columns. This is done very easily manually.
Now, how to do it at runtime through LabVIEW 8.0?
Although, I have done it through labview when there where only two columns, A and B streching up to any length. But, now to save space we are dumping into many columns in the same page and want the chart plot that data as we dump it.
It is tough since I don't know how to assign SourceData of the chart through labview.
I have attached chart's SourceData picture.
Hope you all can solve my problem.
The Y-axis values are: =(good!$B$30:$B$70,good!$D$30:$D$70,good!$F$30:$F$70,good!$H$30:$H$70,good!$B$71:$B$140,good!$D$71:$D$140,good!$F$71:$F$140,good!$H$71:$H$140,good!$B$141:$B$189)
good is the name of the file.
The X- axis values are: =(good!$A$30:$A$70,good!$C$30:$C$70,good!$E$30:$E$70,good!$G$30:$G$70,good!$A$71:$A$140,good!$C$71:$C$140,good!$E$71:$E$140,good!$G$71:$G$140,good!$A$141:$A$189)
See the columns vary from A to F.
I have still not got what I love.....
Attachments:
ExcelChart.JPG 113 KB
SourceData.JPG 34 KB
XY values.JPG 36 KBOk i solved the excel chart problem. Here is the figure showing my victory! But offcourse with NI forum help.
Message Edited by Halemani on 09-19-2008 06:33 AM
I have still not got what I love.....
Attachments:
Chart_XValues_Values.JPG 36 KB -
Top N Analysis with multiple columns
Hi
I am using Oracle 9i. I do have a table which contains datewise promotional material types for an organisation.
The structure is as follows:
CREATE TABLE TEST
(CDATE DATE,
BROCHURE VARCHAR2(1),
WEBSITE VARCHAR2(1),
DIRECT_MAIL VARCHAR2(1),
PRESS_RELEASE VARCHAR2(1),
JOURNAL_AD VARCHAR2(1)
and the sample data is as follows:
CDate Brochure Website Direct_Mail Press_Release Journal_Ad
01/04/1996 Y Y Y N N
02/04/1996 Y Y N N N
23/06/1996 Y N Y Y N
13/09/1996 Y Y N N N
01/04/1997 Y Y N N N
02/04/1997 Y Y Y N Y
23/06/1997 N Y N N Y
13/09/1997 Y Y N N N
01/04/1998 Y Y Y N N
02/04/1998 Y N N Y N
23/06/1998 N Y N N Y
13/09/1998 Y Y N N Y
01/04/1999 Y Y Y N Y
02/04/1999 Y N N Y N
23/06/1999 N Y N N N
13/09/1999 Y Y Y N N
I want to have year wise top 4 promotional types in terms of count of 'Y' only. The result should be like as follows:
YEAR:1996
TYPE COUNT
BROCHURE 4
WEBSITE 3
DIRECT_MAIL 2
PRESS_RELEASE 1
JOURNAL_AD 0
YEAR:1997
TYPE COUNT
WEBSITE 4
BROCHURE 3
JOURNAL_AD 2
DIRECT_MAIL 1
PRESS_RELEASE 1
Please suggest a solution for the same. I am not able to sort it for multiple columns.
Regards
MSOne of the questions that must be asked when you have a requirement to only show the top N ranked items in a list, is "what about a tie in the ranking?".
Oracle has two ranking functions that allow you to deal with either requirement - RANK and DENSE_RANK. Both operate as either analytic or aggregate functions, so either will work for your requirements. The previous posting by Miguel demonstrated how to decode your Y/N flags and pivot the data.
In this example, I've taken the liberty of adding some data to year 2000 that will show the difference between RANK and DENSE_RANK as well as how to use them to filter your results.
First, here's the decoded/pivoted data:
SQL>WITH test AS
2 ( SELECT TO_DATE('01/04/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
3 UNION ALL SELECT TO_DATE('02/04/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
4 UNION ALL SELECT TO_DATE('23/06/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'N' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
5 UNION ALL SELECT TO_DATE('13/09/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
6 UNION ALL SELECT TO_DATE('01/04/1997','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
7 UNION ALL SELECT TO_DATE('02/04/1997','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
8 UNION ALL SELECT TO_DATE('23/06/1997','dd/mm/yyyy') AS CDATE, 'N' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
9 UNION ALL SELECT TO_DATE('13/09/1997','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
10 UNION ALL SELECT TO_DATE('01/04/1998','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
11 UNION ALL SELECT TO_DATE('02/04/1998','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'N' AS WEBSITE, 'N' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
12 UNION ALL SELECT TO_DATE('23/06/1998','dd/mm/yyyy') AS CDATE, 'N' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
13 UNION ALL SELECT TO_DATE('13/09/1998','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
14 UNION ALL SELECT TO_DATE('01/04/1999','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
15 UNION ALL SELECT TO_DATE('02/04/1999','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'N' AS WEBSITE, 'N' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
16 UNION ALL SELECT TO_DATE('23/06/1999','dd/mm/yyyy') AS CDATE, 'N' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
17 UNION ALL SELECT TO_DATE('13/09/1999','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
18 UNION ALL SELECT TO_DATE('01/04/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
19 UNION ALL SELECT TO_DATE('02/04/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
20 UNION ALL SELECT TO_DATE('23/06/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
21 UNION ALL SELECT TO_DATE('13/09/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
22 )
23 SELECT cyear
24 ,ctype
25 ,RANK() OVER (PARTITION BY cyear ORDER BY num_media DESC) ranking
26 ,DENSE_RANK() OVER (PARTITION BY cyear ORDER BY num_media DESC) dense_ranking
27 FROM (SELECT TRUNC(CDATE,'Y') CYEAR
28 ,'BROCHURE' CTYPE, SUM(DECODE(BROCHURE, 'Y', 1, 0)) NUM_MEDIA
29 FROM test
30 GROUP BY TRUNC(CDATE,'Y')
31 UNION ALL
32 SELECT TRUNC(CDATE,'Y') CYEAR
33 ,'WEBSITE' CTYPE, SUM(DECODE(WEBSITE, 'Y', 1, 0))
34 FROM test
35 GROUP BY TRUNC(CDATE,'Y')
36 UNION ALL
37 SELECT TRUNC(CDATE,'Y') CYEAR
38 ,'DIRECT_MAIL' CTYPE, SUM(DECODE(DIRECT_MAIL, 'Y', 1, 0))
39 FROM test
40 GROUP BY TRUNC(CDATE,'Y')
41 UNION ALL
42 SELECT TRUNC(CDATE,'Y') CYEAR
43 ,'PRESS_RELEASE' CTYPE, SUM(DECODE(PRESS_RELEASE, 'Y', 1, 0))
44 FROM test
45 GROUP BY TRUNC(CDATE,'Y')
46 UNION ALL
47 SELECT TRUNC(CDATE,'Y') CYEAR
48 ,'JOURNAL_AD' CTYPE, SUM(DECODE(JOURNAL_AD, 'Y', 1, 0))
49 FROM test
50 GROUP BY TRUNC(CDATE,'Y')
51 )
52* order by cyear desc, ranking
53 /
CYEAR CTYPE RANKING DENSE_RANKING
01-Jan-2000 00:00:00 BROCHURE 1 1
01-Jan-2000 00:00:00 WEBSITE 1 1
01-Jan-2000 00:00:00 DIRECT_MAIL 3 2
01-Jan-2000 00:00:00 PRESS_RELEASE 4 3
01-Jan-2000 00:00:00 JOURNAL_AD 5 4
01-Jan-1999 00:00:00 BROCHURE 1 1
01-Jan-1999 00:00:00 WEBSITE 1 1
01-Jan-1999 00:00:00 DIRECT_MAIL 3 2
01-Jan-1999 00:00:00 PRESS_RELEASE 4 3
01-Jan-1999 00:00:00 JOURNAL_AD 4 3
01-Jan-1998 00:00:00 BROCHURE 1 1
01-Jan-1998 00:00:00 WEBSITE 1 1
01-Jan-1998 00:00:00 JOURNAL_AD 3 2
01-Jan-1998 00:00:00 DIRECT_MAIL 4 3
01-Jan-1998 00:00:00 PRESS_RELEASE 4 3
01-Jan-1997 00:00:00 WEBSITE 1 1
01-Jan-1997 00:00:00 BROCHURE 2 2
01-Jan-1997 00:00:00 JOURNAL_AD 3 3
01-Jan-1997 00:00:00 DIRECT_MAIL 4 4
01-Jan-1997 00:00:00 PRESS_RELEASE 5 5
01-Jan-1996 00:00:00 BROCHURE 1 1
01-Jan-1996 00:00:00 WEBSITE 2 2
01-Jan-1996 00:00:00 DIRECT_MAIL 3 3
01-Jan-1996 00:00:00 PRESS_RELEASE 4 4
01-Jan-1996 00:00:00 JOURNAL_AD 5 5You can see that in year 2000 there is a tie for first place (ranking #1). The RANK function will name the second highest count 3 (skipping the rank of 2 due to the tie), while the DENSE_RANK function will not skip a ranking.
Now, to filter on the ranking, wrap your query in another in-line view like this - but use which ever ranking function YOUR requirements call for:
SQL>WITH test AS
2 ( SELECT TO_DATE('01/04/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
3 UNION ALL SELECT TO_DATE('02/04/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
4 UNION ALL SELECT TO_DATE('23/06/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'N' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
5 UNION ALL SELECT TO_DATE('13/09/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
6 UNION ALL SELECT TO_DATE('01/04/1997','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
7 UNION ALL SELECT TO_DATE('02/04/1997','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
8 UNION ALL SELECT TO_DATE('23/06/1997','dd/mm/yyyy') AS CDATE, 'N' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
9 UNION ALL SELECT TO_DATE('13/09/1997','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
10 UNION ALL SELECT TO_DATE('01/04/1998','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
11 UNION ALL SELECT TO_DATE('02/04/1998','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'N' AS WEBSITE, 'N' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
12 UNION ALL SELECT TO_DATE('23/06/1998','dd/mm/yyyy') AS CDATE, 'N' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
13 UNION ALL SELECT TO_DATE('13/09/1998','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
14 UNION ALL SELECT TO_DATE('01/04/1999','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
15 UNION ALL SELECT TO_DATE('02/04/1999','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'N' AS WEBSITE, 'N' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
16 UNION ALL SELECT TO_DATE('23/06/1999','dd/mm/yyyy') AS CDATE, 'N' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
17 UNION ALL SELECT TO_DATE('13/09/1999','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
18 UNION ALL SELECT TO_DATE('01/04/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
19 UNION ALL SELECT TO_DATE('02/04/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
20 UNION ALL SELECT TO_DATE('23/06/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
21 UNION ALL SELECT TO_DATE('13/09/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
22 )
23 SELECT * FROM (
24 SELECT cyear
25 ,ctype
26 ,RANK() OVER (PARTITION BY cyear ORDER BY num_media DESC) ranking
27 ,DENSE_RANK() OVER (PARTITION BY cyear ORDER BY num_media DESC) dense_ranking
28 FROM (SELECT TRUNC(CDATE,'Y') CYEAR
29 ,'BROCHURE' CTYPE, SUM(DECODE(BROCHURE, 'Y', 1, 0)) NUM_MEDIA
30 FROM test
31 GROUP BY TRUNC(CDATE,'Y')
32 UNION ALL
33 SELECT TRUNC(CDATE,'Y') CYEAR
34 ,'WEBSITE' CTYPE, SUM(DECODE(WEBSITE, 'Y', 1, 0))
35 FROM test
36 GROUP BY TRUNC(CDATE,'Y')
37 UNION ALL
38 SELECT TRUNC(CDATE,'Y') CYEAR
39 ,'DIRECT_MAIL' CTYPE, SUM(DECODE(DIRECT_MAIL, 'Y', 1, 0))
40 FROM test
41 GROUP BY TRUNC(CDATE,'Y')
42 UNION ALL
43 SELECT TRUNC(CDATE,'Y') CYEAR
44 ,'PRESS_RELEASE' CTYPE, SUM(DECODE(PRESS_RELEASE, 'Y', 1, 0))
45 FROM test
46 GROUP BY TRUNC(CDATE,'Y')
47 UNION ALL
48 SELECT TRUNC(CDATE,'Y') CYEAR
49 ,'JOURNAL_AD' CTYPE, SUM(DECODE(JOURNAL_AD, 'Y', 1, 0))
50 FROM test
51 GROUP BY TRUNC(CDATE,'Y')
52 )
53 )
54 where RANKING <= 4
55* order by cyear desc, ranking
56 /
CYEAR CTYPE RANKING DENSE_RANKING
01-Jan-2000 00:00:00 WEBSITE 1 1
01-Jan-2000 00:00:00 BROCHURE 1 1
01-Jan-2000 00:00:00 DIRECT_MAIL 3 2
01-Jan-2000 00:00:00 PRESS_RELEASE 4 3
01-Jan-1999 00:00:00 BROCHURE 1 1
01-Jan-1999 00:00:00 WEBSITE 1 1
01-Jan-1999 00:00:00 DIRECT_MAIL 3 2
01-Jan-1999 00:00:00 JOURNAL_AD 4 3
01-Jan-1999 00:00:00 PRESS_RELEASE 4 3
01-Jan-1998 00:00:00 BROCHURE 1 1
01-Jan-1998 00:00:00 WEBSITE 1 1
01-Jan-1998 00:00:00 JOURNAL_AD 3 2
01-Jan-1998 00:00:00 PRESS_RELEASE 4 3
01-Jan-1998 00:00:00 DIRECT_MAIL 4 3
01-Jan-1997 00:00:00 WEBSITE 1 1
01-Jan-1997 00:00:00 BROCHURE 2 2
01-Jan-1997 00:00:00 JOURNAL_AD 3 3
01-Jan-1997 00:00:00 DIRECT_MAIL 4 4
01-Jan-1996 00:00:00 BROCHURE 1 1
01-Jan-1996 00:00:00 WEBSITE 2 2
01-Jan-1996 00:00:00 DIRECT_MAIL 3 3
01-Jan-1996 00:00:00 PRESS_RELEASE 4 4 -
Conditional order by clause with multiple columns
I would like to know whether it is possible to include multiple columns in a conditional order by clause.
Ex: I have written the following PL / SQL :
CREATE PROCEDURE GetProducts
@OrderBy VARCHAR(50),
@Input2 VARCHAR(30)
AS
BEGIN
SET NOCOUNT ON
SELECT Id, ProductName, Description, Price, Quantity
FROM Products
WHERE ProductName LIKE @Input2
ORDER BY
CASE
WHEN @OrderBy = 'ProductNameAsc' THEN ProductName
END ASC,
CASE
WHEN @OrderBy = 'ProductNameDesc' THEN ProductName
END DESC
END
Now I want to include when the Orderby - "Productnameasc" then order by productname, price, stdate
else
orderby productname, crdate, category
Could this be done? I tried it, but couldn't get this to work.
Any help is greatly appreciated.Since matching ORDER BY columns have different data types (first column for CLERK is sal - number, first column for MANAGER deptno is number but first column for "else" is a string) we need to convert number to string but preserve number sort order. Since DEPTNO is NUMBER(2) we will use TO_CHAR with format 'S00'. Since SAL is NUMBER(7,2) we will use TO_CHAR with format model 'S00000D00'. For EMPNO we will use TO_CHAR with format model 'S0000'.
select deptno,
empno,
ename,
job,
sal
from emp
order by case job
when 'CLERK' then to_char(sal,'S00000D00')
when 'MANAGER' then to_char(deptno,'S00')
else ename
end,
case job
when 'CLERK' then to_char(deptno,'S00')
else job
end,
case job
when 'CLERK' then job
when 'MANAGER' then to_char(empno,'S0000')
end
DEPTNO EMPNO ENAME JOB SAL
20 7369 SMITH CLERK 800
30 7900 JAMES CLERK 950
20 7876 ADAMS CLERK 1100
10 7934 MILLER CLERK 1300
10 7782 CLARK MANAGER 2450
20 7566 JONES MANAGER 2975
30 7698 BLAKE MANAGER 2850
30 7499 ALLEN SALESMAN 1600
20 7902 FORD ANALYST 3000
10 7839 KING PRESIDENT 5000
30 7654 MARTIN SALESMAN 1250
DEPTNO EMPNO ENAME JOB SAL
20 7788 SCOTT ANALYST 3000
30 7844 TURNER SALESMAN 1500
30 7521 WARD SALESMAN 1250
14 rows selected.
SQL> SY. -
Getting a column in numbers '09 to not sort along with other columns
How do I have a header column not sort along with the other columns. for example, if I have a spread sheet with all my contacts and there is a numbers header column on the left, how do I get the last name column to sort but not have the header column sort along with it?
Patrick
Ohiopmalone wrote:
How do I have a header column not sort along with the other columns. for example, if I have a spread sheet with all my contacts and there is a numbers header column on the left, how do I get the last name column to sort but not have the header column sort along with it?
Feature unavailable.
We sort every columns or none of them.
Yvan KOENIG (VALLAURIS, France) vendredi 18 septembre 2009 19:23:57 -
Hi Crystal gurus.
I'm having the report which consist of more that 500 rows , so therefore I decided to implement "Format with multiple rows" feature, which is available in Section Expert area. Everything is just fine, I'm getting multiple columns, but how to suppress the header which is not needed for the last page, because the records are only in the first column.
I can easily copy/paste the header as such, but I do not know how to suppress it. Tried to search here, but found nothing.
Many thanks in advance McmerphyIf it truely is the last page of the report, you could try a conditional suppression where pagenumber = totalpagecount. But this would always suppress the header selected for suppression, and if you should get another column on the last page, it will still suppress.
Debi
Maybe you are looking for
-
Problem splitting catalog in Lightroom 2.1
I am using Windows XP w/sp2 and have migrated to Lightroom 2.1. There are two people sharing one catalog each with one master folder in the catalog and a hierarchy of sub folders. I have tried to set up a second catalog for the second user. Wanting t
-
Idoc error - Modify or delete Source List - any ideas experts PLZ?
Hi experts, I create a source list record by using Idoc with segments E1EORDH and E1EORDM the source list record is correctly created in database <u>=> the problem is when I try to modify or delete this source list record</u> <b>Error message (always
-
Hi ! For an automated test I need to deploy some text or HTML files to a Web AS ABAP. Planned to use the mime repository for this, BUT ... Is there any possibility to access a folder of the MIME repository by a public URL (no login required) ? If yes
-
Nudge function with arrows will not work in PS cs2
I recently installed photoshop cs2 on my pc with windows vista home premium. And the nudge function will not work using the arrows. Is there a work around for this?
-
MAXFORMULACACHESIZE erorr in Essbase 11.1.2
Hi experts, I am currently working on Essbase ASO Application. When I am trying to prepare the aggregations on ASO app, I keep getting an error Not enough memory for formula execution. Set MAXFORMULACACHESIZE configuration parameter to [2543]KB and t