Multiple column headers in a single DataGrid?
Suppose i wanted to display information on, say, invoices.
So, i want to display one part of my DataGrid with only invoices from the last 30 days, the next section for 30-60 days old, and the third section is 90 days+ old.
I want it to look, basically, like this:
30 Days or less
Customer Days Old amount
Mr. X cleaning 15 20.76
7-11 3 7.11
30-60 days old
Customer Days Old amount
Barney's 75 12.34
Watto's part shop 80 1200.89
90 days or older
Customer Days Old amount
Sprint 144 30.63
Is it possible to do this in a single DataGrid? I want the mulitple column headers, but want to be able to get rid of them and combine all this data into a single DataGrid with all invoices, if needs be. In that case all but the top column header titles would disappear.
Any info on this is appreciated.
thanks!
Hi,
You can do grouping with advance datagrid.
http://livedocs.adobe.com/flex/3/html/help.html?content=advdatagrid_02.html
Rgds
Johnny
Similar Messages
-
Comparison of multiple column values with a single column value
I have two separate tables say Tab1 and Tab2
I want to select some datas , which is common to both the tables.
In tab1 , there is a column 'STATE' and it's value is 'A'
In tab2, there are multiple columns for the state, say STATE_A,STATE_B, STATE_C ETC and a row is present with the following details
STATE_A = 1, STATE_B =1 ,STATE_C =0,STATE_D=1
I need to select STATE when STATE_A ='1',
if my STATE='B', this STATE has to be selected since STATE_B =' 1', similraly
if my STATE='D', this STATE has to be selected since STATE_D =' 1',
If my STATE='C', STATE_C should not get selected since it's '0'.
Is it possible to do this in a single SELECT statement, where I have some other checks also or else how can I achieve it?Maybe this will help
Select * from STATE_MAS ;
STATE
A
B
D
F
H
Select * from STATE_CHILD
STATE_A STATE_B STATE_C STATE_D STATE_E STATE_F STATE_G STATE_H STATE_I STATE_J
1 0 0 1 1 0 0 0 0 0
CREATE OR REPLACE FUNCTION GET_STATE (P_VAL VARCHAR) RETURN NUMBER IS
V_SQL VARCHAR2(200);
V_COL VARCHAR2(35);
P_RETURN NUMBER ;
BEGIN
V_COL := 'STATE_'||P_VAL;
V_SQL := 'SELECT 1 FROM STATE_CHILD WHERE '||V_COL||' = 1 ';
EXECUTE IMMEDIATE V_SQL INTO P_RETURN ;
RETURN P_RETURN ;
END;
SELECT STATE FROM STATE_MAS
WHERE GET_STATE(STATE) = 1 ;
STATE
A
D -
SQL Multiple Columns Displayed in a Single Row
Hello everyone,
I have 2 tables, Product and Product_Name, one Product can have more than one name.
I need to retrieve it in such a way that I show the Product_ID followed by all the names this product has.
I'm not able to make it, every way I try I get the Product ID duplicated and several rows with a different product name on each row as follows:
1, 'Iron Z"
1, 'Iron M'
1, 'Iron N'
2, 'Wood P'
2, 'Wood M'
What I need is:
1, Iron Z, Iron M, Iron N
2, Wood P, Wood M
Thanks and Regards.Hi,
user10103934 wrote:
Thank you for the answer Frank,
Iron Z, Iron M and Iron N would be 3 different entries on the same column.
I'm sure the LISTAGG function would resolve this, the problem is that I was hoping to get a solution on pure SQL or PL/SQL, maybe with a nested Select.
My Oracle version is 10g Express Edition.LISTAGG is pure SQL, but it was only introduced in Oracle 11.2. Everything mentioned below should work in Oracle 10.
The STRAGG function from that page is very useful. You have to copy and install about 60 line of PL/SQL code. Do that once, and then you can use it hundreds of times in hundreds of queries, just as if it was a built-in function. The main problem with STRAGG is that it's hard to get soprted output from it. There's a modified version, designed for sorted output, on this thread:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:15637744429336
Never used it. Can't vouch for it.
SYS_CONNECT_BY_PATH seems to be the most popular way of doing string aggregation in Oracle 10. The example given on the Oracle Base page (which I posted in my last message) is a little clumsy and inefficient. See the following thread for a better example, using CONNECT_BY_ISLEAF:
Re: Concatenate strings from more rows into one row.
or, now that I see it, Pollywog's example above.
Edited by: Frank Kulash on Jun 11, 2010 2:24 PM -
Popup List with multiple columns but returning a single column (key value)
Hi,
1. Is it not possible to show a POPup (returning a key value) or Select list with more than 1 column? If so how?
2. I have an item in a page which should be hidden if 1 particular button was pressed. This is is to use the same page but have some behavioural change based on which button (option) was selected. How can I get the name of the BUTTON PRESSED TO INVOKE THIS PAGE.
thanks
SebJosHi,
In that case, you should make the page item conditional. There are many techniques to do this but it would depend on what the button is for.
As a simple example...
1 - Create a hidden item on your page called, say, Pn_SHOW (replace n with your page number - eg, P1_SHOW). Set the default value of this item to either 0 (zero) or 1 - 0 will hide the item and 1 will display it, so in your example, set it to 0
2 - On the page item you want to show/hide - on its definition, you have a Conditions section. Set the following:
Condition Type: Value of Item in Expression 1 = Expression 2
Expression 1: P1_SHOW
Expression 2: 1
When the page is loaded, because the value of P1_SHOW is 0, and due to the conditions we have just set (where P1_SHOW must be 1 for the item to be shown), the item will not appear on the page.
When you created your button, a new page branch should have been created. On this branch, you have two settings - "Set these items" and "With these values". Set the following:
Set these items: P1_SHOW
With these values: 0
You should also have at least one other branch on your page - one of these will need to set the value of P1_SHOW to 1 to get the item to display.
Andy -
How to calculate the individual sums of multiple columns in a single query
Hello,
Using Oracle 11gR2 on windows 7 client. I have a question on calculating sum() on multiple columns on different columns and store the results in a view. Unfortunately I could not post the problem here as it keeps on giving error "Sorry, this content is not allowed", without telling where or what it is! So I had to post it in the stack-overflow forum, here is the link: http://stackoverflow.com/questions/16529721/how-to-calculate-the-individual-sums-of-multiple-columns-in-a-single-query-ora
Will appreciate any help or suggestion.
Thanksuser13667036 wrote:
Hello,
Using Oracle 11gR2 on windows 7 client. I have a question on calculating sum() on multiple columns on different columns and store the results in a view. Unfortunately I could not post the problem here as it keeps on giving error "Sorry, this content is not allowed", without telling where or what it is! So I had to post it in the stack-overflow forum, here is the link: http://stackoverflow.com/questions/16529721/how-to-calculate-the-individual-sums-of-multiple-columns-in-a-single-query-ora
Will appreciate any help or suggestion.
ThanksLooks like you want a simple group by.
select
yr
, mnth
, region
, sum(handled_package)
, sum(expected_missing_package)
, sum(actual_missing_package)
from test
group by
yr, mnth, region
order by
yr, mnth, region;I wouldn't recommend storing your data for year / month in 2 columns like that unless you have a really good reason. I would store it as a date column and add a check constraint to ensure that the date is always the first of the month, then format it out as you wish to the client.
CREATE TABLE test
year_month date,
Region VARCHAR2(50),
CITY VARCHAR2(50),
Handled_Package NUMBER,
Expected_Missing_Package NUMBER,
Actual_Missing_Package NUMBER
alter table test add constraint firs_of_month check (year_month = trunc(year_month, 'mm'));
ME_XE?Insert into TEST (year_month, REGION, CITY, HANDLED_PACKAGE, EXPECTED_MISSING_PACKAGE, ACTUAL_MISSING_PACKAGE)
2 Values (to_date('2012-nov-12', 'yyyy-mon-dd'), 'Western', 'San Fransisco', 200, 10, 5);
Insert into TEST (year_month, REGION, CITY, HANDLED_PACKAGE, EXPECTED_MISSING_PACKAGE, ACTUAL_MISSING_PACKAGE)
ERROR at line 1:
ORA-02290: check constraint (TUBBY.FIRS_OF_MONTH) violated
Elapsed: 00:00:00.03
ME_XE?Insert into TEST (year_month, REGION, CITY, HANDLED_PACKAGE, EXPECTED_MISSING_PACKAGE, ACTUAL_MISSING_PACKAGE)
2 Values (to_date('2012-nov-01', 'yyyy-mon-dd'), 'Western', 'San Fransisco', 200, 10, 5);
1 row created.
Elapsed: 00:00:00.01
ME_XE?select
2 to_char(year_month, 'fmYYYY') as year
3 , to_char(year_month, 'fmMonth') as month
4 , Region
5 , CITY
6 , Handled_Package
7 , Expected_Missing_Package
8 , Actual_Missing_Package
9 from test;
YEAR MONTH REGION CITY HANDLED_PACKAGE EXPECTED_MISSING_PACKAGE ACTUAL_MISSING_PACKAGE
2012 November Western San Fransisco 200 10 5
1 row selected.
Elapsed: 00:00:00.01
ME_XE?Then you have nice a nice and easy validation that ensures you data integrity.
Cheers, -
Using sql load insert multiple fields data into a single column in database
Hi ,
I have my log file in sun OS box something like this
=======
(07/29/2009 00:02:24.467) 367518 (07/29/2009 00:02:26.214) 949384011
(07/29/2009 00:02:26.236) 3675 (07/29/2009 00:02:28.207) 949395117
(07/29/2009 00:02:28.240) 337710 (07/29/2009 00:02:30.621) 949400864
=============
I am trying to insert the data into oracle data base as follows.
=============================
column1 : (07/29/2009 00:02:24.467)
column2 : 367518
column3 : (07/29/2009 00:02:26.214)
column4 : 949384011
===========================
Can anyone help me with the control file format?
someone suggested me the code below.
==========
LOAD DATA
INFILE 'D:\work\load.txt'
INTO TABLE sample
(col1 POSITION(02:24) char,
col2 POSITION(27:32) INTEGER EXTERNAL,
col3 POSITION(35:57) CHAR,
col4 POSITION(60:68) INTEGER EXTERNAL
===========
but this works only for the fixed length data? Please helpuser11744904 wrote:
Hi ,
I have my log file in sun OS box something like this
=======
(07/29/2009 00:02:24.467) 367518 (07/29/2009 00:02:26.214) 949384011
(07/29/2009 00:02:26.236) 3675 (07/29/2009 00:02:28.207) 949395117
(07/29/2009 00:02:28.240) 337710 (07/29/2009 00:02:30.621) 949400864
=============
I am trying to insert the data into oracle data base as follows.
=============================
column1 : (07/29/2009 00:02:24.467)
column2 : 367518
column3 : (07/29/2009 00:02:26.214)
column4 : 949384011
===========================
Can anyone help me with the control file format?
someone suggested me the code below.
==========
LOAD DATA
INFILE 'D:\work\load.txt'
INTO TABLE sample
(col1 POSITION(02:24) char,
col2 POSITION(27:32) INTEGER EXTERNAL,
col3 POSITION(35:57) CHAR,
col4 POSITION(60:68) INTEGER EXTERNAL
===========
but this works only for the fixed length data? Please helpIs the requirement to load all data in a single column or multiple columns? The thread subject and body are conflicting. -
Displaying data from multiple columns into a single line graph
Post Author: hollowmatrix
CA Forum: WebIntelligence Reporting
Hey,I have an issue with the WEBI reporting.I have a data source that has multiple columns say ( month1, month2, month3, month4,.....month 12, month 13, ....month24) with the sales data for each month.Now say I call the month 1 to month 12 as "current year", and call month 13 - month 24 as "previous year".I want to put a prompt in the report which allows me to select between "current year" and "previous year".Based on the prompt value we get a graph of the sales vs month ....as in if we select "current year", then we get a graph of the sales Vs time( remember that the sales data for each month is in a different column.)and if we select "previous year" then we get a graph of the sales Vs time for previous year..( sales vs time for Month 13, month 14, month 15....month 24).I am not able to pull data from multiple columns into a single object that I can use to populate the graphs.Any help on the same will be appreciated .Hi,
<p>
please click
here (asktom) and look for the words "how about the other way round"
</p> -
How to insert from one table to another (multiple columns to single column)
I want to insert data from table1 into table2 and the data looks in 3 columns as below
Table1
RepNm ObjNm DbNm
123 abc def
456 def xyz
789 123 456
and the data in table2 should be display as
Table 2
ObjNm
123
456
789
abc
def
xyz
the dupes should get eliminated and only the distinct values should be inserted into a single column in table2 from multiple columns in table1How do you want to handle nulls? If there is a null in any value of a column, do you want to insert it?
Then,
WITH T
AS (SELECT LEVEL colnum
FROM DUAL
CONNECT BY LEVEL <= 3)
SELECT DECODE (colnum, 1, RepNm, 2, ObjNm, 3, DbNm) as ObjNm
FROM table1, T;if you dont want to insert nulls then,
WITH T
AS (SELECT LEVEL colnum
FROM DUAL
CONNECT BY LEVEL <= 3)
SELECT DECODE (colnum, 1, RepNm, 2, ObjNm, 3, DbNm) AS ObjNm
FROM table1, T
WHERE DECODE (colnum, 1, RepNm, 2, ObjNm, 3, DbNm) = DECODE (colnum, 1, RepNm, 2, ObjNm, 3, DbNm)G. -
Performance of update query for single column vs multiple column
Hi All,
I could not find any answer for this, does it ever matter in terms of performance updating single column versus multiple column in a single update query.
For eg. table consisting of 15 columns, what would be the difference in performance when one column is update in the single query against another update query where 15 columns are updated.
Please do keep in mind my table columns in actually could be around 150+.
Thanks for any information provided.If updated columns aren´t on where clause , then the only impact of 15 columns will be a increase on redo generation, and a possible chainning row.
So since the redo is one of the things that have a large impact, the answer is yes.
The performance will be slower.
Regards
Helio Dias.
http://heliodias.com
OCE SQL, OCP 9i -
NamedQuery problem- single argument compared to multiple columns
Hello,
I'm not sure if this issue is a bug or if I'm misinterpreting the API. I'm trying to execute a text search query against multiple columns in the same table via EJB 3.0, e.g.
select object(o) from Location o where o.city LIKE :searchString OR o.county LIKE :searchString"So, a single text argument is compared to multiple fields- but I keep getting an exception that the number of supplied arguments (one) does not match the number of required arguments (one- even though it's ID is referenced twice). Is there a separate syntax for repeating arguments in EQL (EJB 3.0, JDeveloper 10.1.3)? Is it not supported?
I get around the issue by just specifying a Query at runtime, but I'd prefer --if possible-- to create a NamedQuery instead.
Any help would be appreciated. Take care.Should the EJBQL statement be
select object(o) from Location o where o.city LIKE :?1 OR o.county LIKE :?2 -
Merge statement - update multiple columns from a single sub-select
Is it possible to write in 10gR2, a MERGE statement, with UPDATE for multiple columns from a single sub_select?
like this:
MERGE INTO tableA
using ( select * from temp) tmp
on( tableA. col1 = tmp.col1)
when matched then
update set ( tableA.col5,
tableA.col6,
tableA.col7) = ( select sum(col2), sum(col3), sum(col5)
from tableX
where tableX.col1 = tableA.col1...)Hi,
The USING clause is not a sub-query, so it can't reference columns from tables that are not in it.
Include tableA in the USING clause if you really need to refer to it there. (It's not obvious that you do.)
As always, it helps if you post:
(1) The version of Oracle (and any other relevant software) you're using
(2) A little sample data (just enough to show what the problem is) from all the relevant tables
(3) The results you want from that data (In the case of a DML statement, such as MERGE, this will be the state of the tables when everything is finished.)
(4) Your best attempt so far (formatted)
(5) The full error message (if any), including line number
Executable SQL statements (like "CREATE TABLE AS ..." or "INSERT ..." statements) are best for (2).
If you can present your problem using commonly available tables (for example, tables in scott schema, or views in the data dictionary), then you can omit (2).
Formatted tabular output is okay for (3). -
Update multiple columns with single update statement..
HI all,
i am reading the columns value from different table but i want to update it with signle update statement..
such as how to update multiple columns (50 columns) of table with single update statement .. is there any sql statement available i know it how to do with pl/sql..As I understood, may be this. Here i am updating ename,sal, comm columns all at once.
SQL> select * from emp where empno=7369;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17/12/1980 12:00:00 800 20
SQL> UPDATE emp
2 SET ename = lower (ename),
3 sal = sal + 1000,
4 comm = 100
5 WHERE empno = 7369;
1 row updated.
SQL> select * from emp where empno=7369;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 smith CLERK 7902 17/12/1980 12:00:00 1800 100 20
SQL> UPDATE emp
2 SET ename = (SELECT 'ABCD' FROM DUAL),
3 sal = (SELECT 1000 FROM DUAL),
4 comm = (SELECT 100 FROM DUAL)
5 WHERE empno = 7369;
1 row updated. -
Merge multiple rows into single row (but multiple columns)
How to merge multiple rows into single row (but multiple columns) efficiently.
For example
IDVal IDDesc IdNum Id_Information_Type Attribute_1 Attribute_2 Attribute_3 Attribute_4 Attribute_5
23 asdc 1 Location USA NM ABQ Four Seasons 87106
23 asdc 1 Stats 2300 91.7 8.2 85432
23 asdc 1 Audit 1996 June 17 1200
65 affc 2 Location USA TX AUS Hilton 92305
65 affc 2 Stats 5510 42.7 46 9999
65 affc 2 Audit 1996 July 172 1100
where different attributes mean different thing for each Information_type.
For example for Information_Type=Location
Attribute_1 means Country
Attribute_2 means State and so on.
For example for Information_Type=Stats
Attribute_1 means Population
Attribute_2 means American Ethnicity percentage and so on.
I want to create a view that shows like below:
IDVal IDDesc IDNum Country State City Hotel ZipCode Population American% Other% Area Audit Year AuditMonth Audit Type AuditTime
23 asdc 1 USA NM ABQ FourSeasons 87106 2300 91.7 46 85432 1996 June 17 1200
65 affc 2 USA TX AUS Hilton 92305 5510 42.7 46 9999 1996 July 172 1100
ThanksHi,
That's called Pivoting . The forum FAQ has a section on this subject: {message:id=9360005}
I hope this answers your question.
If not, post your best attempt, along with a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data. (You did post the results you wanted, but they're very hard to read because they're not formatted. Use \ tags, as described in the forum FAQ, below.)
Explain, using specific examples, how you get the results you want from the data given.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0). This is always important, but especially so with pivots.
See the forum FAQ {message:id=9360002} -
Converting multiple column in single column
Hi All,
I need to create a table with single column by using select statement with multiple columns
For Ex- i have 1 row with 10 columns (may be more than 10) like
'A','B','C','D','E','F','G','H',I','J'
i written sql like
select 'A','B','C','D','E','F','G','H','I','J' from dual
result is - 'A','B','C','D','E','F','G','H','I','J' with 10 columns
Now i need output lik this using SQL
Text
'A'
'B'
'C'
'D'
'E'
'F'
'G'
'H'
'I'
'J'
Please help me to sort out this problem. Your help would highly appropriated.
Regards
Raju
Edited by: 888667 on Apr 8, 2013 10:54 PM
Edited by: 888667 on Apr 8, 2013 10:56 PMWelcome to the forum!!! You can convert column to row like this
SQL>with my_table
2 as
3 (
4 select 'A' col1,'B' col2,'C' col3,'D' col4,'E' col5,'F' col6,'G' col7,'H' col8,'I' col9,'J' col10
5 from dual
6 )
7 select decode(no , 1, col1, 2, col2, 3, col3, 4, col4, 5, col5, 6, col6, 7, col7, 8, col8, 9, col9, 10, col10) col
8 from my_table
9 cross join (select level no from dual connect by level <= 10)
10 /
C
A
B
C
D
E
F
G
H
I
J
10 rows selected.
SQL> To ask question in a better way please read {message:id=9360002} from FAQ -
JTable: Multiple Columns to Single Header
Hi
How is it possible to allocate multiple columns in a JTable to the one header.
I retrieve a resultset from a DB. At present 'firstname' and 'lastname' go into separate columns with separate headers.('firstname' and 'lastname')
I would like to either combine 'firstname' and 'lastname' then add to the table as one column, or, leave 'firstname' and 'lastname' as is and combine the headers of these columns.
Not sure how to go about this...
Any help would be appreciated,
Thanks
GreggLook at http://www2.gol.com/users/tame/
Maybe you are looking for
-
How can I find the total number of songs in my iTunes library?
I just downloaded the new itunes. In the previous itune library at the bottom of the screen it told me how many songs I have total. Not just purchased, but how many total songs were in my library. I liked knowing this because I could verify my ipo
-
Same material can exist on multiple line items for the same order.
Hi Is there any specific customising setting or web shop setting through which we can restrict user to add same material on multiple line items for the same order ? Regards
-
Updated to iOS 7.1.1 newsfeed in Facebook won't display?
Updated to iOS 7.1.1 this morning and the newsfeed in Facebook won't display, instead it's find a friend page! How do I fix this please?
-
HT5071 are there any other templates we can choose from?
Are there any other templates I can choose from or I can buy?
-
Word 2010 Send As Attachment does not send a HTML formatted mail
Hi! I'm using Word 2010 to send a document by clicking File->Save & Send->Send Using E-mail->Send as Attachment. In the Outlook 2010 new message window I click the ribbon tab Format Text and then I select HTML as the message format. I continue to ha