Dynamic display of columns in the pivot query
I have a table called STUDENT_SCORE. I need to display the avarage score/month for 2 years and the monthly score until today "month.Then assume that it is April 2009. The report will look like
Roll_id 2007avg 2008avg Jan09-Mar09 Feb 09
101 80.9 70.9 89.7 90.9 56.8
102 70.9 23.9 87.2 90.0 76.8
I tried a bit, but can't fix the monthly score display dynamically.
DDL/DML is as below
create the table STUDENT_SCORE
(number of roll_id,
date of mth_id,
The partition number);
insert into STUDENT_SCORE values
(101, to_date (January 1, 2006 ', ' dd/mm/yyyy'), 67.5);
insert into STUDENT_SCORE values
(101, to_date (February 1, 2006 ', ' dd/mm/yyyy'), 77.5);
insert into STUDENT_SCORE values
(101, to_date (March 1, 2006 ', ' dd/mm/yyyy'), 87.5).
insert into STUDENT_SCORE values
(101, to_date (April 1, 2006 ', ' dd/mm/yyyy'), 27.5);
insert into STUDENT_SCORE values
(101, to_date (May 1, 2006 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (June 1, 2006 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (July 1, 2006 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (August 1, 2006 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (September 1, 2006 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (October 1, 2006 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (November 1, 2006 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (December 1, 2006 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (January 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (February 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (March 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (April 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (May 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (June 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (July 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (August 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (September 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (October 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (November 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (December 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (1 January 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (February 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (March 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (April 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (May 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (June 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (July 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (August 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (September 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (October 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (November 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (December 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(101, to_date (January 1, 2009 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (January 1, 2006 ', ' dd/mm/yyyy'), 67.5);
insert into STUDENT_SCORE values
(102, to_date (February 1, 2006 ', ' dd/mm/yyyy'), 77.5);
insert into STUDENT_SCORE values
(102, to_date (March 1, 2006 ', ' dd/mm/yyyy'), 87.5).
insert into STUDENT_SCORE values
(102, to_date (April 1, 2006 ', ' dd/mm/yyyy'), 27.5);
insert into STUDENT_SCORE values
(102, to_date (May 1, 2006 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (June 1, 2006 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (July 1, 2006 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (August 1, 2006 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (September 1, 2006 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (October 1, 2006 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (November 1, 2006 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (December 1, 2006 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (January 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (February 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (March 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (April 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (May 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (June 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (July 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (August 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (September 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (October 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (November 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (December 1, 2007 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (1 January 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (February 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (March 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (April 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (May 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (June 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (July 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (August 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (September 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (October 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (November 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (December 1, 2008 ', ' dd/mm/yyyy'), 57.5);
insert into STUDENT_SCORE values
(102, to_date (January 1, 2009 ', ' dd/mm/yyyy'), 57.5);
Hello
The script below produces what you want (as far as I can tell, without your desired results).
Student_score_smry subquery Gets the year and monthly averages of student_score.
It is completely static: it always produces 11 monthly columns (from January to November) and the names of columns hardcoded (m01 through m11).
For dynamic column names you need, I used SQL * COLUMN more orders.
To get the variable number of monthly columns you need, SELECT from the main query clause uses a script under (dynamic_month.sql) to only show the correct number (which can be 0).
The student_score_wk_smry of subquery retrieves the weekly averages of the student_score_wk.
He, too, is completely static: it always produces 6 weekly columns with names hardcoded (w1 through w6).
There are four preliminary motions, that write two scripts under:
Prelimiary C1, C2 and C3 queries write orders of COLUMN for annual, monthly and weekly columns in dynamic_columns.sql
Preliminary motion M written between 0 and 11 items in SELECT-clause in sub-script dynamic_month.sql
The main script is:
SET FEEDBACK OFF
SET LINESIZE 200
SET PAGESIZE 0
SET VERIFY OFF
SPOOL dynamic_column.sql
-- Preliminary query C1: Columns for last 2 years
SELECT 'COLUMN y'
|| LEVEL
|| ' HEADING "'
|| TO_CHAR ( ADD_MONTHS ( &target_month
, 12 * (-3 + LEVEL)
)
, 'YYYY'
)
|| 'avg"'
FROM dual
CONNECT BY LEVEL <= 2
;
-- Preliminary query C2: 11 prior months in this year
SELECT 'COLUMN m'
|| TO_CHAR (LEVEL, 'fm00')
|| ' HEADING "'
|| TO_CHAR ( ADD_MONTHS ( TRUNC (&target_month, 'YYYY')
, LEVEL - 1
)
, 'MonYY'
)
|| '"'
FROM dual
CONNECT BY LEVEL <= 11
;
-- Preliminary query C3: 6 weeks before target_month
WITH got_w_num AS
(
SELECT SUBSTR (week_desc, 1, 6) AS mon_dd
, ROW_NUMBER () OVER
( ORDER BY week_id DESC
) AS w_num
FROM week
WHERE TO_DATE (week_desc, 'Mon DD, YYYY') < &target_month
)
SELECT 'COLUMN w'
|| TO_CHAR (7 - w_num)
|| ' HEADING "Week of '
|| mon_dd
|| '"'
FROM got_w_num
WHERE w_num <= 6
ORDER BY w_num DESC
;
SPOOL OFF
-- Preliminary Query M: 0-11 months (in SELECT clause)
SPOOL dynamic_month.sql
SELECT ', m'
|| TO_CHAR (LEVEL, 'fm00')
FROM dual
WHERE MONTHS_BETWEEN (&target_month, TRUNC (&target_month, 'YYYY')) >= 1
CONNECT BY LEVEL <= MONTHS_BETWEEN (&target_month, TRUNC (&target_month, 'YYYY'))
;
SPOOL OFF
-- Restore SQL*Plus features suppressed earlier
SET FEEDBACK ON
SET LINESIZE 80
SET PAGESIZE 50
-- COLUMN Commands
@dynamic_column.sql
-- Main Query
WITH student_score_smry AS
(
SELECT roll_id
, AVG (CASE WHEN TRUNC (mth_id, 'YYYY') = TRUNC (ADD_MONTHS (&target_month, -24), 'YYYY') THEN score END) AS y1
, AVG (CASE WHEN TRUNC (mth_id, 'YYYY') = TRUNC (ADD_MONTHS (&target_month, -12), 'YYYY') THEN score END) AS y2
, AVG (CASE WHEN TRUNC (mth_id, 'MM') = TRUNC (&target_month, 'YYYY') THEN score END) AS m01
, AVG (CASE WHEN TRUNC (mth_id, 'MM') = ADD_MONTHS (TRUNC (&target_month, 'YYYY'), 1) THEN score END) AS m02
, AVG (CASE WHEN TRUNC (mth_id, 'MM') = ADD_MONTHS (TRUNC (&target_month, 'YYYY'), 2) THEN score END) AS m03
, AVG (CASE WHEN TRUNC (mth_id, 'MM') = ADD_MONTHS (TRUNC (&target_month, 'YYYY'), 3) THEN score END) AS m04
, AVG (CASE WHEN TRUNC (mth_id, 'MM') = ADD_MONTHS (TRUNC (&target_month, 'YYYY'), 4) THEN score END) AS m05
, AVG (CASE WHEN TRUNC (mth_id, 'MM') = ADD_MONTHS (TRUNC (&target_month, 'YYYY'), 5) THEN score END) AS m06
, AVG (CASE WHEN TRUNC (mth_id, 'MM') = ADD_MONTHS (TRUNC (&target_month, 'YYYY'), 6) THEN score END) AS m07
, AVG (CASE WHEN TRUNC (mth_id, 'MM') = ADD_MONTHS (TRUNC (&target_month, 'YYYY'), 7) THEN score END) AS m08
, AVG (CASE WHEN TRUNC (mth_id, 'MM') = ADD_MONTHS (TRUNC (&target_month, 'YYYY'), 8) THEN score END) AS m09
, AVG (CASE WHEN TRUNC (mth_id, 'MM') = ADD_MONTHS (TRUNC (&target_month, 'YYYY'), 9) THEN score END) AS m10
, AVG (CASE WHEN TRUNC (mth_id, 'MM') = ADD_MONTHS (TRUNC (&target_month, 'YYYY'), 10) THEN score END) AS m11
FROM student_score
GROUP BY roll_id
)
, got_w_num AS
(
SELECT week_id
, ROW_NUMBER () OVER
( ORDER BY week_id DESC
) AS w_num
FROM week
WHERE TO_DATE (week_desc, 'Mon DD, YYYY') < &target_month
)
, student_score_wk_smry AS
(
SELECT roll_id
, AVG (CASE WHEN W_NUM = 6 THEN score END) AS w1
, AVG (CASE WHEN W_NUM = 5 THEN score END) AS w2
, AVG (CASE WHEN W_NUM = 4 THEN score END) AS w3
, AVG (CASE WHEN W_NUM = 3 THEN score END) AS w4
, AVG (CASE WHEN W_NUM = 2 THEN score END) AS w5
, AVG (CASE WHEN W_NUM = 1 THEN score END) AS w6
FROM student_score_wk s
JOIN got_w_num w ON s.wk_id = w.week_id
WHERE w_num <= 6
GROUP BY roll_id
)
SELECT NVL (ss.roll_id, ssw.roll_id) AS roll_id
, y1, y2
@dynamic_month.sql
, w1, w2, w3, w4, w5, w6
FROM student_score_smry ss
FULL OUTER JOIN student_score_wk_smry ssw ON ss.roll_id = ssw.roll_id
ORDER BY roll_id
;
Sub-script dynamic_column.sql might look like this:
COLUMN y1 HEADING "2007avg"
COLUMN y2 HEADING "2008avg"
COLUMN m01 HEADING "Jan09"
COLUMN m02 HEADING "Feb09"
COLUMN m03 HEADING "Mar09"
COLUMN m04 HEADING "Apr09"
COLUMN m05 HEADING "May09"
COLUMN m06 HEADING "Jun09"
COLUMN m07 HEADING "Jul09"
COLUMN m08 HEADING "Aug09"
COLUMN m09 HEADING "Sep09"
COLUMN m10 HEADING "Oct09"
COLUMN m11 HEADING "Nov09"
COLUMN w1 HEADING "Week of Dec 21"
COLUMN w2 HEADING "Week of Dec 28"
COLUMN w3 HEADING "Week of Jan 04"
COLUMN w4 HEADING "Week of Jan 11"
COLUMN w5 HEADING "Week of Jan 18"
COLUMN w6 HEADING "Week of Jan 25"
Other sub-script, dynamic_month.sql, might look like this:
, m01
, m02
, m03
Tags: Database
Similar Questions
-
Dynamic number of columns in the table
Hello
I use JDev 10.1.3.3.0 with ADF. I just want to create a table, with a dynamic number of columns in the table. The background is that a user of my webapplication can create and submit a sql query. Now, I have to show him the results. My idea was, I have save the result in a bean managed (ResultTable), which is stored in the session context and map at my table in my page.
If I search the Forum and don't get only one useful thread: {: identifier of the thread = 971888}, but I don't exactly understand. What is the CollectionModel? Do I need this?
I'm trying to report on the following:
ResultTable
ResultColumnpublic class ResultTable { public static final String SESSION_NAME = "ResultTable"; private ArrayList<ResultColumn> columnList; private CollectionModel collectionModel; public ResultTable() { } public ArrayList<ResultColumn> getColumnList() { return columnList; } public void setColumnList(ArrayList<ResultColumn> columnList) { this.columnList = columnList; } }
ResultTablepublic class ResultColumn { private ArrayList<ResultRow> rowList; private String name; public ResultColumn() { } public ArrayList<ResultRow> getRowList() { return rowList; } public void setRowList(ArrayList<ResultRow> rowList) { this.rowList = rowList; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
My showResult.jspxpublic class ResultRow { private String value; public ResultRow() { } public String getValue() { return value; } public void setValue(String value) { this.value = value; } }
The ResultTable was filled with data, but the Board is not filled. So, I think, it must be rejected to the data binding.<af:table emptyText="No items were found" value="ResultTable.columnList" var="column" varStatus="colStatus" id="table1"> <af:forEach items="#{column.rowList}" var="row" varStatus="rowStatus"> <af:column sortable="false" headerText="#{column.name}" id="column#{colStatus.index}"> <af:outputText value="#{row.value}" id="outputText#{rowStatus.index}"/> </af:column> </af:forEach> </af:table>
I get warnings and errors to run too. But I don't know if they are the result or cause of my problem.
Concerning27.10.2009 10:15:41 oracle.adfinternal.view.faces.renderkit.core.xhtml.TableRenderer renderTableWithoutColumns WARNUNG: Table with id: form1:table1 has no visible columns! 27.10.2009 10:15:41 oracle.adfinternal.view.faces.io.HtmlResponseWriter endElement SCHWERWIEGEND: Element End name:span does not match start name:div 27.10.2009 10:15:41 oracle.adfinternal.view.faces.io.HtmlResponseWriter endElement SCHWERWIEGEND: Element End name:span does not match start name:div 27.10.2009 10:15:41 oracle.adfinternal.view.faces.io.HtmlResponseWriter endElement SCHWERWIEGEND: Element End name:form does not match start name:span 27.10.2009 10:15:41 oracle.adfinternal.view.faces.io.HtmlResponseWriter endElement SCHWERWIEGEND: Element End name:body does not match start name:form 27.10.2009 10:15:41 oracle.adfinternal.view.faces.io.HtmlResponseWriter endElement SCHWERWIEGEND: Element End name:html does not match start name:body
MajoHi Mario,.
Note that your JSPX snippet above has serious shortcomings:
- 'ResultTable.rowList' is not an EL expression, but the value attribute of the af: table must refer to an EL expression
- Items AF:foreach = "#{row.cellList}"-you don't have to store information about the columns of all rows, more it won't work as af:forEach tag may not see the value of the expression of EL #{line} (or any component EL expression created). " See the tagdoc here: http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/tagdoc/core/forEach.html
- "ID =" Column #{cellStatus.index} "and id =" outputText #{rowStatus.index} "are invalid and that they don't compile even as id attributes cannot contain EL expressions.
.
I think to solve your problem, you need three things:
- List of columns (for example the list
If you need to store only the names of column or list If you need additional information),.
- list of lines,
- a line can be a map (with the name of the column - cell data mapping; card e.g.
) or a list (with columns indexed; for example - list of lines,
-
dynamically display title based on the value selected in the column picker
Hi all
Would it be possible to display the title of the dynamic report based on the value selected in the column picker. Suppose I have two State of the column and region. When I choose the status in the column picker the title of the report will show 'Summary of the situation' when I'll choose the region then the title will change to "summary of the region. Please help me...Hello
Check your mail before I send the entire process with screenshots.
Concerning
NGO
-
Dynamically show/hide columns in the reports of the IR
Env
RDBMS: Oracle XE 11.2
Request Express 4.2.4.00.08
Hi all
I am bulding an open source oracle apex app to track aircraft using ADS - B technology.
I have somes types of units. for example (kilometers, miles, knots, feet and metres).
So, in the report of the IR, I want pick capable of showing a unit in time.
For example
Radio Group.
Ground speed: (*) km/h () Mhp (Knt)
Vertical speed: (*) ft/s (m/s)
Can anyone help to build a code or point a direction to get above result?
I tried already a thread, but did not work.
Apex: Display/hide report column with Radio button. 2 cents to Oracle by Christoph
Display / hide column IR dynamically
I have a limited knowledge of Oracle APEX.
Levi Pereira says:
I am bulding an open source oracle apex app to track aircraft using ADS - B technology.
I have somes types of units. for example (kilometers, miles, knots, feet and metres).
So, in the report of the IR, I want pick capable of showing a unit in time.
For example
Group of radio buttons.
Ground speed: (*) km/h () Mhp (Knt)
Vertical speed: (*) ft/s (m/s)
There are different ways to do this. Probably the easiest would be:
- Create lists of values (LOVs) for units.
- Add the elements of the Group of radio -based unity LOVs report interactive region (IR), by specifying one of the units as a default value.
- Present the radio group via the Items property of the Page to send IR region.
- Create multi-column report for each metric combination / unit.
- Control the display of the report columns (applies to IR, but also classic report columns) conditionally using value of element in the Expression 1 = Expression 2 conditions Expression 1 is the group element of relevant radio and Expression 2 unit LOV value corresponding to that used in the column of the report.
- Add a dynamic action on the evolution of the components of the radio to refresh the IR region.
A less obvious approach would also use LOVs, group radio elements and dynamic action of change/update as above, but only have one column for each measure in the report. The column value is calculated using an expression based on the value of the radio group, for example:
. . . /* Assuming base speed unit is km/h */ ground_speed * case :p1_ground_speed_unit when 'mph' then 0.621371 when 'kn' then 0.539957 else 1 end ground_speed . . .
The unit could be indicated in the column heading in the report referring to the element of the device by using a substitution of static text string:
Ground Speed (&P1_GROUND_SPEED_UNIT.)
-
How to dynamically add a column to the DataGrid
Hey there everyone. Forgive me, I'm very new to this.
I use a data grid to display values analyzed in an xml file.
The application needs of 5 columns, no problem, however, if a value is present in the xml file, I need to add another column.
If I have a var defined as
var gps_present which is a string, and if the value == 'Yes' adds a column in my datagrid?
< mx:DataGrid id = "summary_grid" x = "10" y = "15" width = "500" height = "434".
dataProvider = "{summary.lastResult.phones.phone}" >
< mx:columns >
< mx:DataGridColumn headerText = "phone number" dataField = "phone number" width = "3" / >
< mx:DataGridColumn headerText = "inc_java" dataField = "inc_java" width = "3" / >
< mx:DataGridColumn headerText = "inc_sms" dataField = "inc_sms" width = "3" / >
a logic here if inc_gps == 'y '.
< mx:DataGridColumn headerText = "inc_gps" dataField = "gps" width = "3" / >
< / mx:columns >
< / mx:DataGrid >
Thank you for any advice on that.
nephish,
Yes. Sorry, displaying large blocks of code on the forums is a little tricky. Posted an example here: http://blog.flexexamples.com/2008/03/04/dynamically-adding-new-columns-to-a-datagrid-contr ol in flex /
Hope that helps,
Peter -
How to use a formula in column in the main query?
Hi all
I tried to use a formula columns defined in a query in the State of the query like this:
where (: cf_ex -: cf_ex2) > = 5
but when I run the report returned data! Why? and how to use the status of the query?
Note: I'm using Forms 6iI gave you the reason:
Formula columns are not part of the select statement (which runs in the database), but are dealt with in the report.
So you actually reference the user settings in the query, not formulas columns.(Well, I should have said "you are referencing empty connection parameters", but with your experience you could have understood that)
and the solution:Create database for cf_ex and cf_ex2 functions and use them in your application.
-
Calculation on two columns in the pivot table
Hi all
I have a vision:
Dept. year amount
Accounting 500 $2010
Accounting 700 $2011
$100 engineering 2010
$600 engineering 2011
and etc.
PivotTable: (data displayed side by side)
Dept: 2010 2011
Accounting 500 $700 $
Engineering 100-$600
Is there a way of PivotTable to create the additional column, and do the math on this column? New column called 'Change' (amount of real computation of 2010 less amount of 2011 by each Department). I see the function to duplicate columns in the PivotTable. But that's it... without additional calculations.
Thank you in advance,
SonyaPretty easy simple n...
Your year must be in the columns area... Simply create a new collar calculated say diff with function as formula and formula of the sale as a "2011" "- 2010". This will give you the sum of diff. You can do this more flexible by making use of $1 & $2 to reference...
-
reduce the number of columns in the case query
Hi all
I'm running on 10 G R/2.
I have a query that produces columns with the number of steps.
SUM (CASE WHEN LTRIM (RTRIM (W_O)) = 'ROKOLBIN' THEN 1 ELSE 0 END) AS "O_ROKOLBIN."
SUM (CASE WHEN LTRIM (RTRIM (W_I)) = 'ROKOLBIN' THEN 0 OTHERWISE 1 END) AS "I_ROKOLBIN."
sum (case when LTRIM (RTRIM (W_O)) = "SYLVAIN", then 1 else 0 end) as "O_GULURU."
sum (case when LTRIM (RTRIM (W_I)) = "SYLVAIN", then 1 else 0 end) as "I_GULURU."
sum (case when LTRIM (RTRIM (W_ON)) = 'PURE' then 1 else 0 end) as "O_PURE."
I want to reduce the number of columns to 2,
A column is for Division.Division can be O_ROKOLBIN, I_ROKOLBIN, O_GULURU, I_GULURU, O_PURE
The other column is Subtotal.Subtotal are the sums as above, SUM (CASE WHEN LTRIM (RTRIM (W_O)) = "ROKOLBIN", 1.)
Can anyone advie how I acheiev it.
Thank you.Hello
CrackerJack wrote:
... Data are from Jan 12 to today, 1 million + records, that's why I'm unable to provide comprehensive data and simply copied an example of data.Nobody wants you to post 1 million rows. 10 lines can be many. Just examples of data make sure that validation really produces the results you post.
>I copied data from 16 Jan just differentiate different dates.
I also tried trunc, but who has still not the sum of each divisions.
Highlight a few places where the query I posted produces erroneous results and explain how to get good results in these places. Give concrete examples showing how to get the correct results of the sample data.
-
Prevention of Mult. Select all THE values column of the pivot table
All,
Is there a way to prevent the behavior when viewing a PivotTable and using a Mult. Select guest, choosing mult. values and each pivot has all THE column values for all THE pivots on the screen?
For example, lets say we had the following in the pivot:
Column: STATE
Line: PRODUCT
and we had a Mult. Select a prompt on the REGION - East, West, Central, West
If I've chosen is in the prompt, I get all the States of the REGION of the East for the first values.
If I choose the East and the West in the prompt, I get a pivot showing amounts East and Southeastern States in the Western States AND top (no value, of course) at the top. I also have an another pivot below showing the amounts of the West and Western States, AND the Northeastern States (no values for the Eastern States).
In other words, all States that are in the mult. REGION show selected in each pivot.
Thank you.Uh, that's what I said...
-
display / hide column of the table running
Are there known issues with display / hide a column of the table at run time?
I have a table that contains a column with a check box and another with a radio button. If the user is allowed to select more than one row in the table (as indicated by a form variable), then I want to hide the column of radio and checkbox column. If not, I want to show / hide the contrary.
I show / hide the column header too. When I preview the form, however, the data in the table appears "scoot" left and placed in the column that is hidden, so to speak.
Here is a view of the design of the table:
And a view of the execution of the table. You can see the radio is hidden, but the "account number" column wants to crush in the (hidden) radio column,
Here is the script, I'm very confident in this small snippet of code because the lines of account were filling wonderfully until I added the column of radio buttons and the script to show/hide.
Put the account data in the table
function
setAccountData (objAccountRow, objAccountItem) //Pass in the line and data to complete line
{
stuff the line
objAccountRow.accountNumber.rawValue
= objAccountItem.accountNumber;
objAccountRow.accountName.rawValue
= objAccountItem.accountName;
objAccountRow.accountBalance.rawValue
= objAccountItem.accountBalance;
display the check box or radio button, depending on the number of accounts they are allowed to select (as specified by the form variable)
var searchNumAccounts = objFragment.resolveNode("searchNumAccounts").value; Variable //Form
if (searchNumAccounts==1)
{ //show the column of radio buttons and hide the checkbox column }
hideObject (objResultsSubform.accounts.HeaderRow.txtSelect); <-it's exaggerated here, to hide the table for each row header column,...
hideObject (objAccountRow.accountSelected);
showObject (objResultsSubform.accounts.HeaderRow.txtRadioSelect);
showObject (objAccountRow.radioSubform.radioGroup.selected);
}
on the other
{ //show the checkbox column and hide the column of radio }
hideObject (objResultsSubform.accounts.HeaderRow.txtRadioSelect);
hideObject (objAccountRow.radioSubform.radioGroup.selected);
showObject (objResultsSubform.accounts.HeaderRow.txtSelect);
showObject (objAccountRow.accountSelected);
}
}
OK I got it. The table object implements a container to contain the fields. You hid the ok fields, but you then never reset the row in the table to have only two columns. I copied the parameter of the XML source so that I would have the exact width and then deleted the one I wanted to hide. Now everything works fine.
See the example updated the.
Paul
-
Display two columns of the sum
Hi all
I am a beginner and need help on a requirement.
I have a table.
Level of ID data
----------------------
1 TL 200
1 BT 200
1 TL 200
1 BT 300
2 TL 300
BT 2 400
I want to display:
ID Sum (BT) Sum (TL)
----------------------------------
1 500 400
2 400 300
Thank you very much.You have to change the table and column names.
The column names that you use are reserved words of Oracle...select pk , sum(case when lvl = 'BT' then descr else 0 end )sumBT , sum(case when lvl = 'TL' then descr else 0 end )sumTL from t group by pk;
Output:
PK SUMBT SUMTL ---------- ---------- ---------- 1 500 400 2 400 300 2 rows selected.
-
Dynamic display of table on the page of the ADF
I'm looking for a page ADF that has a drop down box whose name table as inputs and when he selected should show data within this table in the ADF array element.Arun,
What do you mean by "more simple? Another way to proceed would be to have fragments of JSF page separated for each table and use a dynamic region on the home page. I haven't worked through the solution, but it should work.
John
-
Sorting of rows and columns in the pivot table
My XML:
With the help of the wizard, I created the corss-tab (table 2 x 2)<ROWSET> <data> <R>C</R> <C>3</C> <V>C3</V> </data> <data> <R>C</R> <C>2</C> <V>C2</V> </data> <data> <R>B</R> <C>1</C> <V>B1</V> </data> <data> <R>B</R> <C>3</C> <V>B3</V> </data> <data> <R>A</R> <C>2</C> <V>A2</V> </data> <data> <R>A</R> <C>3</C> <V>A3</V> </data> </ROWSET>
produce the following output:(1,1) RC (1,2) <?for-each-group@column:data;./C?> <?C?> <?end for-each-group?> (2,1) <?for-each-group:data;./R?><?variable@incontext:G1;current-group()?><?R?> (2,2) <?for-each-group@cell://data;./C?><? ($G1[(./C=current()/C)]/V)?> <?end for-each-group?>group?>
I need the same exit, just with the rows/columns properly ordained. Help, please. Thank you.------------------------- RC 3 2 1 ------------------------- C C3 C2 ------------------------- B B3 B1 ------------------------- A A3 A2 -------------------------
Hello
with this code
Cell (1,2): <? for-each-group@column:data;. / C ? > <? type: C? > <? C? > <? end for each group -? >
Cell (2,1): <? for-each-group: data; / R ? > <? type: R? > <? variable@InContext:G1;current-group()? > <? R? >
Cell (2.2): <? for each group-@cell://data;. / C ? > <? type: C? > <? ($G1_SQUAREBRACKET_(./C=current()/C)]/V)? > <? end for each group -? >and get your data
.....|.. 1..|... 2...|... 3
A.............. A2... A3
B...... B1............... B3
C............... C2... C3Concerning
Rainer -
Displays two values in the column with the concatenation of good
I have a query Select col1 | ' >' || col2 from table1.
For example: the table below has the records.
Col1 Col2
Orange color
red color
White color
Yellow color
Result of: existing query
Orange > color
Red > color
White > color
Yellow > color
But I want to display two columns in the order appropriate as the below one.
Veuileez note that all the the first character of the col2 must start the position of sampe in a row.
Orange > > color
Red > > > > color
White > > > color
Yellow > > > colorHello
Knowing the value that should be completed when running...SQL> with tab as 2 (select 'Orange' Col1, 'color' Col2 from dual union all 3 select 'red' , 'color' from dual union all 4 select 'White' , 'color' from dual union all 5 select 'Yellow' , 'color' from dual) 6 Select RPAD(col1,(select max(length(col1)) +1 7 from tab),chr(32))||chr(9) ||col2 data 8 from tab; DATA -------------------------------------------------------------- Orange color red color White color Yellow color
Twinkle
-
How to display a list of the columns (search bar - not displayed) in ascending order
Hello
I'll have an interactive report...
In the Search bar we have to Select columns, unless we must do not display it.
where all the columns (not shown) are listed.
How can we display these columns in increasing order
Thank you
DeepakYou want to display these columns in the IR?
In the affirmative. Select the column you want to display, and then click on the the ' > '.
In the interactive report regions - source, where you have your query to select columns use to rank them by order of the Association.You want to keep these columns as "do not display" and make them in the Association order it?
Select all the columns to display and return the columns selections making "Not displayed" region order assn.
Or in the query, select the columns in the desired order.I don't know if I'm helping. I fell like I got your question all wrong. Still...
Published by: machan on December 11, 2009 11:01
Maybe you are looking for
-
Photosmart 6520 does not print the new black ink cartridge
My new black ink no longer works on the printer. This seems to be a problem throughout all of the printers HP no matter what model. Did someone with similar problems had success getting their black to print despite all recommendations of manufactur
-
How can I update to ios6 ios7
-
Casting of object type to aid to more specific
Hello I'm bit stuck in the legacies of the class in my current project. I implement a zero-coupling messaging architecture that uses variant tables to store objects to be cast to sample. The good news: it works in general, little we take a peek at so
-
Cannot install the update KB2729449
KB 2729449 keeps not I tried 4 or 5 times
-
is the new photosmart 5524 ok for my new hp 14 chromebook
page asks the email address for the new printer. can I use own email or can I just make a new one for the printer only?