How to set a dynamic column to count the quarter of each year?
Lets see the result which now displayed:YEARS MONTHS SUMMONTH SUMYEAR SUMQUARTER
----- ------ -------- ------- ----------
2009 Jan 127994 1766166 449652
2009 Feb 168106 1766166 449652
2009 Mar 153552 1766166 449652
2009 Apr 160329 1766166 438913
2009 May 137605 1766166 438913
2009 Jun 140979 1766166 438913
2009 Jul 148606 1766166 435283
2009 Aug 150390 1766166 435283
2009 Sep 136287 1766166 435283
2009 Oct 149529 1766166 442318
2009 Nov 153268 1766166 442318
2009 Dec 139521 1766166 442318
2010 Jan 124670 1721212 407181
2010 Feb 139278 1721212 407181
2010 Mar 143233 1721212 407181
2010 Apr 149518 1721212 444112
2010 May 152292 1721212 444112
2010 Jun 142302 1721212 444112
2010 Jul 149125 1721212 412855
2010 Aug 130328 1721212 412855
2010 Sep 133402 1721212 412855
2010 Oct 157754 1721212 457064
2010 Nov 137078 1721212 457064
2010 Dec 162232 1721212 457064
The problem is about how Dynamic a new column called 'Q_count' to count each displayed line belong to which quarter of the year?In addition, she repeats once again next year.
For example:
* Jan - Mar 2009 will show "q1", Apr - Jun will display 'q2'... and 2010 Jan - Mar, he will again show "q1" and so will guess
Here is my sql I use:
select years,months,summonth,sumyear,sumquarter
from(
select years,months,summonth,sumyear,
sum(sumhour) over(partition by years || to_char(ym, 'Q') order by years || to_char(ym, 'Q')) sumquarter,ym
from(
select years, months, days, hours, mins, sumHour, SUM (sumHour) OVER (PARTITION BY years,months,days) sumDay, SUM (sumHour) OVER (PARTITION BY years,months) sumMonth, SUM (sumHour) OVER (PARTITION BY years) sumyear,
to_date(years || months, 'YYYYMon', 'NLS_DATE_LANGUAGE=American') ym
from (SELECT x.years, x.months, x.days, x.hours, x.mins, sum(x.value) as sumHour
FROM xmltest,
XMLTABLE ('$d/cdata/name' passing xmldoc as "d"
COLUMNS
years integer path 'year',
months varchar(3) path 'month',
days varchar(2) path 'day',
hours varchar(2) path 'hour',
mins varchar(2) path 'minute',
value float path 'value'
) as X
group by x.years, x.months, x.days, x.hours, x.mins
order by x.years, x.months, x.days
)
)
)
group by years,months,summonth,sumyear,sumquarter,ym
order by ym
Thanks everybody helps me!
Hello
TO_CHAR ( TO_DATE (months, 'Mon')
, '"q"Q'
)
Returns a string of characters 2 'T1', '2', "q3" or "q4" as you asked for it.
You can use it in your main SELECT clause.
Tags: Database
Similar Questions
-
Hello
I would like to know how to set up a personalized message for the prevention of the installation of the software via group policy in windows server 2012 R2.
I released some software in my field to a distribution point and I of installation for few of them software restriction policies. But I don't want the default next message below:
"The system administrator has set policies to prevent this installation." This installation is forbidden by system policy. Contact your system administrator. »
Instead, I would like to set up a custom message. Please tell us how can I do same by using Group Policy, if not available, what are the alternatives that I can use.
This issue is beyond the scope of this site (for consumers) and to be sure, you get the best (and fastest) reply, we have to ask either on Technet (for IT Pro) or MSDN (for developers)* -
How to set text in an object, so the object expands with the text and has even space on both sides of the object in illustrator cc?
R,
You can do this:
(1) create the initial direct Type;
(2) in the appearance palette dialog, click on add a new fill and define the color as you wish;
(3) effect > convert to shape > Rectangle corners round/Rectangle/Ellipse and set parent > width/extra height as you wish (essentially what needs to be added to the size of the bounding box, if anything).
After that you can change the Type and the filled area will fit as shown on the picture.
-
How to load a multiple column table in the coherence of caches?
How to load a multiple column table in the coherence of caches?
I want to load a multi-column (about 20 columns) table in cache coherence. How to change the following code (spatially how to change the SQL SELECT statement)?
Is the following select statement enough: Select the key, the value of EMPLOYEES ?
public static void bulkLoad(NamedCache cache, Connection conn) { Statement s; ResultSet rs; try { s = conn.createStatement(); rs = s.executeQuery("select key, value from table"); while (rs.next()) { Integer key = new Integer(rs.getInt(1)); String value = rs.getString(2); cache.put(key, value); } ... } catch (SQLException e) {...} }
First of all, you need a class to hold your 20 fields:
public class Data { private String field1; private String field2; private String field3; private String field4; private String field5; private String field6; private String field7; private String field8; private String field9; private String field10; private String field11; private String field12; private String field13; private String field14; private String field15; private String field16; private String field17; private String field18; private String field19; private String field20; public Data() { } public String getField1() { return field1; } public void setField1(String field1) { this.field1 = field1; } public String getField2() { return field2; } public void setField2(String field2) { this.field2 = field2; } public String getField3() { return field3; } public void setField3(String field3) { this.field3 = field3; } public String getField4() { return field4; } public void setField4(String field4) { this.field4 = field4; } public String getField5() { return field5; } public void setField5(String field5) { this.field5 = field5; } public String getField6() { return field6; } public void setField6(String field6) { this.field6 = field6; } public String getField7() { return field7; } public void setField7(String field7) { this.field7 = field7; } public String getField8() { return field8; } public void setField8(String field8) { this.field8 = field8; } public String getField9() { return field9; } public void setField9(String field9) { this.field9 = field9; } public String getField10() { return field10; } public void setField10(String field10) { this.field10 = field10; } public String getField11() { return field11; } public void setField11(String field11) { this.field11 = field11; } public String getField12() { return field12; } public void setField12(String field12) { this.field12 = field12; } public String getField13() { return field13; } public void setField13(String field13) { this.field13 = field13; } public String getField14() { return field14; } public void setField14(String field14) { this.field14 = field14; } public String getField15() { return field15; } public void setField15(String field15) { this.field15 = field15; } public String getField16() { return field16; } public void setField16(String field16) { this.field16 = field16; } public String getField17() { return field17; } public void setField17(String field17) { this.field17 = field17; } public String getField18() { return field18; } public void setField18(String field18) { this.field18 = field18; } public String getField19() { return field19; } public void setField19(String field19) { this.field19 = field19; } public String getField20() { return field20; } public void setField20(String field20) { this.field20 = field20; } }
Then you can use it to store data in you original code
public static void bulkLoad(NamedCache cache, Connection conn) { Statement s; ResultSet rs; try { s = conn.createStatement(); String sql = "select key, value, value2, " + "value3, value4, value5, value6, " + "value7, value8, value9, value10 " + "value11, value12, value13, value14, " + "value15, value16, value17, value18, " + "value19, value120 from table"; rs = s.executeQuery(sql); while (rs.next()) { Integer key = new Integer(rs.getInt(1)); Data data = new Data(); data.setField1(rs.getString(2)); data.setField2(rs.getString(3)); data.setField3(rs.getString(4)); data.setField4(rs.getString(5)); data.setField5(rs.getString(6)); data.setField6(rs.getString(7)); data.setField7(rs.getString(8)); data.setField8(rs.getString(9)); data.setField9(rs.getString(10)); data.setField10(rs.getString(11)); data.setField11(rs.getString(12)); data.setField12(rs.getString(13)); data.setField13(rs.getString(14)); data.setField14(rs.getString(15)); data.setField15(rs.getString(16)); data.setField16(rs.getString(17)); data.setField17(rs.getString(18)); data.setField18(rs.getString(19)); data.setField19(rs.getString(20)); data.setField20(rs.getString(21)); cache.put(key, data); } ... } catch (SQLException e) {...} }
Of course your data object would need the appropriate field names and you will have no channels for all types. It must also implement equals and hashCode and ideally PortableObject.
JK
-
PDFMaker, Options, create PDF/A-1 a in Word. Where can I change the setting so I did not check the box for each file, I create?
Win OS: Windows 7
Acrobat 9 Pro
Hello
You can do this to change the registry settings.
Go to run type Regedit to open it.
First make a backup of the registry.
Here is how do.
Go to HKEY_CURRENT_USER > software > Adobe > Acrobat > PDFMaker 9.0 > > Word > settings
You need to change the DWORD values & chain listed below.
Chain: JobOptions
Value: PDFA1b 2005 RGB
DWORD: PDFComplianceIndex
Value: 1
DWORD: PDFComplianceLevel
Value: 1
Close the registry editor
Thank you
Abhishek
-
Hi all
Suppose I have table, whose structure changes frequently on a daily basis.
For example. / / desc my_table gives you after the name of the column the day 1
SQL > my_table DESC;
Output
Name
Age
Phone
Day 2, two other columns are added, viz, address and salary.
SQL > my_table DESC;
Output
Name
Age
Phone
Address
Salary
Now, I want to create a Dynnamic RTF report which made extracting data from all columns from my_table daily. For this, I have defined a simultaneous program with XML output type and include in annex a data/definition of data model that takes XML as input and gives the final result of the conc program in EXCEL layout. I am able to do that for a constant number of columns, but don't know how to do it when the number of columns to display dynamically changes.
For 1 day my XML file should be like this.
<?xml version="1.0" encoding="UTF-8"?> <dataTemplate name="XYZ" description="iExpenses Report" Version="1.0"> <dataQuery> <sqlStatement name="Q2"> <![CDATA[ SELECT Name ,Age ,Phone FROM my_table ]]> </sqlStatement> </dataQuery> <dataStructure> <group name="G_my_table" source="Q2"> <element name="Name" value="Name" /> <element name="Age" value="Age" /> <element name="Phone" value="Phone" /> </group> </dataStructure> </dataTemplate>
And my day 1, EXCEL output RTF model should be like this.
Name age phoneSwapnill 23 12345
For 2 days my XML file should be like this. With 2 new columns selected in the SELECT clause.
<?xml version="1.0" encoding="UTF-8"?> <dataTemplate name="XYZ" description="iExpenses Report" Version="1.0"> <dataQuery> <sqlStatement name="Q2"> <![CDATA[ SELECT Name ,Age ,Phone ,Address ,Salary FROM my_table ]]> </sqlStatement> </dataQuery> <dataStructure> <group name="G_my_table" source="Q2"> <element name="Name" value="Name" /> <element name="Age" value="Age" /> <element name="Phone" value="Phone" /> <element name="Address" value="Address" /> <element name="Salary" value="Salary" /> </group> </dataStructure> </dataTemplate>
And my day 2, exit EXCEL model RTF should be like this.
Name address telephone pay23 12345 Madrid 100000 Swapnill
Now, I don't know below things.
- Make the dynamic XML as we did in the day 1 there are 3 columns in the SELECT statement and the day 2, 5 columns. I want to create a dynamic XML which must not be changed if the new columns are added into my_table. I don't know how to create this query and also create their corresponding items below.
- Make the RTF model dyanamic as day 1 there are 3 exit EXCEL columns and the day 2, 5 columns. I want to create a dynamic RTF model that would display all the columns selected in XML dynamic. I don't know how the RTF will create new XML tags and how it will know where to place them in the report. Means, I can create model RTF day 1, by loading the XML data for 3 columns and place 3 tags XML in the model. But how he will create and place the tags for the new columns the day 2?
Hope so, you got my requirement, it's difficult. Please let me know how I can implement the necessary solution using the RTF dynamically without any manual intervention.
Kind regards
Patricia K.
Post edited by: SwapnilK
Hi guys,.
I was able to solve above the requirement.
I created a procedure that would create & update (attached to the data definition) XML file dynamically for each race. This dynamic XML contains the SQL statement for the data query that is built dynamically. I am updating this XML file using XDOLoader utility to the definition of data. Then run my program customized to generate the excel output.
Exit excel retrieves correct number of columns dynamically (3 on Day1 and Day2 5), with corresponding data records.
Kind regards
Patricia K.
-
Question newbie Oracle SQL adding columns to count the contents of the other columns
Greetings,
I do not understand how to integrate charges to my current SQL code that would consist of food and then the elements of the car for each person. Once I understood this concept I want to apply to my real data base (Oracle) where I count medication and problems for each patient.
Using my data of test below, for example the My goal would be to have the number of columns show that Cathy had County 3 foods and an element 1 cars (the County would need to ignore the values zero in these columns). I really don't like if the counter value is repeated in every row for that person.
Select data1. Name, data1. Category, Data1.Results,
Box When data1. IN category ("food") then end FOOD data1.results,
Box When data1. IN category ('Cars') then data1. Results end of CARS
Of
(
Select T1.name name, category null, null results in a_Main T1, a_Food T2 where T1.cpi_seq = T2. CPI_SEQ
UNION
Select T1.name, 'food', T2. Food a_Main T1, a_Food T2 where T1.cpi_seq = T2. CPI_SEQ
UNION
Select T1.name, 'cars', T3. Cars a_Main T1, a_Cars T3 where T1.cpi_seq = T3. CPI_SEQ
) data1
where data1. Category is not null
by name, category
Name Category Results FOOD CARS Cathy cars Fiero NULL VALUE Fiero Cathy food Soaking of the points Soaking of the points NULL VALUE Cathy food Scoop Scoop NULL VALUE Cathy food SoftServe SoftServe NULL VALUE Dave cars Firebird NULL VALUE Firebird Dave cars Gremlin NULL VALUE Gremlin Dave cars Transport NULL VALUE Transport Dave cars Vega NULL VALUE Vega Dave food Count Chocula Count Chocula NULL VALUE Dave food Donuts Donuts NULL VALUE Dave food Little retarded Little retarded NULL VALUE Dave food Pizza Pizza NULL VALUE Mary cars Taurus NULL VALUE Taurus Mary food Bird seed Bird seed NULL VALUE Mike cars Honda NULL VALUE Honda Mike cars Jeep NULL VALUE Jeep Mike food Burger Burger NULL VALUE Mike food Fries Fries NULL VALUE Mike food Foam Foam NULL VALUE Sue cars Pinto NULL VALUE Pinto Sue cars Taurus NULL VALUE Taurus Sue food Humus Humus NULL VALUE Sue food Kabooli Kabooli NULL VALUE Select data1. Name, data1. Category, Data1.Results,
Box When data1. IN category ("food") then end FOOD data1.results,
Box When data1. IN category ('Cars') then data1. Results end of CARS,
Count (*) over (partition t1.name, data1. NTC category),
Of
(
Another way would be
Select
..
de)
all
)
Group
name
Category
order by
name
Category
Depends on your needs (for example, the final projection).
-
Dynamic columns to fit the APEX 4.2 screens
Hello
I developed an interactive report in APEX 4.1 that displays data as a table with three columns (see query below). I want to dynamically set the number of columns depending on the size of the screen. For example, a smart phone should probably only display a single column and a 20 "+ monitor could hold five or six columns."
As you can see, I'm currently hardcode the number of columns using the decoding functions and mod. thanks for the help!create table photo (id number, last_modified date); select trunc(last_modified, 'hh') hour_modified, -- Groups rownumbers into 3-columns-per-row max(decode(mod(rn, 3), 1, last_modified, null)) modified1, max(decode(mod(rn, 3), 2, last_modified, null)) modified2, max(decode(mod(rn, 3), 0, last_modified, null)) modified3, max(decode(mod(rn, 3), 1, id, null)) id1, max(decode(mod(rn, 3), 2, id, null)) id2, max(decode(mod(rn, 3), 0, id, null)) id3 from (select p.id, p.last_modified, row_number() over (partition by trunc(p.last_modified, 'hh') order by p.last_modified) rn from photo p) group by trunc(last_modified, 'hh'), -- Groups rownumbers into 3-columns-per-row ceil(rn/3) order by hour_modified, modified1;
Yes
I don't think you can use an instance of interactive report in this situation.
In addition to needing a different report for each #columns you want to host.
A lot of the interactive report features must be switch of.
For example the column selection. Do not want users of the column Photo1. Because then the photo 1, 4, 7 are not shown.The column break actualy breeze your go see [url http://apex.oracle.com/pls/apex/f?p=VANBAREN_FORUM_TRY_OUT:FLUENTIR & c = VANBAREN] this example
The report should be ordered on the family name and DepartmentI've implemented for examples that shows grouped by Department employees where the number of employees next to each other depends on the room that is available.
[url http://apex.oracle.com/pls/apex/f?p=VANBAREN_FORUM_TRY_OUT:FLUENTGENERIC & c = VANBAREN] The first uses a generic and breaking definend by the report model.
[url http://apex.oracle.com/pls/apex/f?p=VANBAREN_FORUM_TRY_OUT:FLUENTNAMED & c = VANBAREN] The second one uses a named column model and uses the condition of models for breaking.This approach allows you to control not only on your go. You can display more information. It becomes possible screen time that the picture was taken under the photo by simply adding the column to the statement select source.
And you have more control over the design, because decide you the used attributes and CSS classes.Nicolette
Published by: Nicolette on 15-dec-2012 22:06
Change the url of the demo application. After the alias of application not being not only more. -
Apex - how to set hide and show checkboxes at the event button
Hello
How to set up HIDE/SHOW check boxes when click on the events button. (apex)
If I press the button and then the box will appear.
If I press it again then check box will be disapper.
Can u please help me solve this issues in the APEX.
Thanks in advance.
concerning
rMy steps:
1 create the point of the box
LOV:select 'orange' d, 'orange' r from dual union all select 'apple' d, 'apple' r from dual union all select 'banana' d, 'banana' r from dual
2. create the region button. Specify the redirect URL and URL target as #.
3. create a dynamic action
Advanced
Event: Right click; Selection type: jQuery Selector; Select jQuery: button [value = "Toggle"]<-- where="" toggle="" is="" the="" label="" of="" my="">-->
Action: Run the JavaScript Code. Fire when the Page loads: uncheck the box. Code:var ele = $('#P34_FRUIT'); if (ele.css('display') == 'none'){ $x_Show(ele); } else { $x_Hide(ele); }
Leave the rest and click on create
Click the button to see it disappear and other things (not tested in IE).
I did sample: http://apex.oracle.com/pls/apex/f?p=23834:34
-
HP LaserJet Pro P1606dn: How to set up a static ip on the HP LaserJet Pro P1606dn
How to set static IP on the printer.
Unfortunatle I can't access the web page of the printer with DHCP.
Are there any options to achieve this without page EWS?
I can open the EWS page if I connect the printer via USB to give it a static IP address?
Welcome @munish259272,
Thanks to their participation in Forums of HP! I see by your post that you want to configure a static IP address for the printer. I can help you.
You will need to access the server the printer embedded Web via IP address of the network printer.
I have provided a document to configure the static IP address, go to Solution 4: assign your printer an IP under Windows: does not maintain connection printer wireless. Do not take into account the title.
Feel free to click on the button 'Accept as Solution' and the 'Thumbs Up' for my help. Please let me know the results and if there is anything else I can help you. Thank you! -
How to set a user account to have the same settings as the administrator account
How to configure a user account to have the same settings as the administrator account. using windows xp pro with service pack 3
Set the "parameters of same.
If you want that the user has administrator privileges, then all you need to do is to add the user to the group "Administrators". To do this, right-click on 'My computer', select 'Manage' and open the "local users and groups" section. Click on 'Groups', double click on "Administrators" and add the user to the administrator group.
If you set 'settings' and things like wallpaper and other preferences, there isn't a way to do that easily other than to simply set these parameters.
Hope this helps,
JW -
Dynamic columns based on the user login
Dear Experts,
Is it possible to display the columns dynamically according to the connection of the BI Publisher user?
For example, if the report of RTF model has 10 columns in total and if I connect with a user named "abc", I should be able to see, say 6 columns containing information about the user "abc".
And if I have connection with "xyz", I should be able to see, say 7 columns containing information about the user "xyz".
I will be able to assign to which column should be displayed to the user who?
If there is a way to achieve this scenario, please let me know as soon as possible, since there is an urgent need.
Your help will be very appreciated.
Thanks in advance!
Yes, using: xdo_user_name in the SQL data model, you can get the details for user identification.
Then use this model column RTF for display of the dynamic columns.
Example:
Select: xdo_user_name as USER_ID of the double
In RTF
Column header Column data -
How to set programmatically different view settings in the same workflow
Hi all
I have a business view that calls another view activity B with a link. In this connection, the action takes place to a method (I use the class JSFUtils: http://jdeveloper-adf.googlecode.com/svn/trunk/TGPrototype2/ViewController/src/com/tgslc/defaultManagement/utils/JSFUtils.java):
public String goToB() {}
String paramToPass = "someParameterTakenInSomeWay";
JSFUtils.setExpressionValue("#{pathToViewB_pageBPageDef.paramName}",paramToPass);
Return "openActivityB";
}
where openActivityB is the case of control flow to call B.
In the file for pageDef B, I put a parameter "paramName" worthless:
<? XML version = "1.0" encoding = "UTF-8"? >
< pageDefinition xmlns = "http://xmlns.oracle.com/adfm/uimodel."
version = "11.1.1.59.23" id = "pageBPageDef" >
< Parameters >
< parameter id = "paramName".
value = "" / >
< / Parameter >
< executables / >
< bindings / >
< / pageDefinition >
But at the time of operation, I have an oracle.jbo.expr.JIEvalException:
Houston-25077: paramName not found in the object name specified: pathToViewB_pageBPageDef.
The question is: How can I set the parameter view activity programmatically?
Note that I use this method to set the parameter because in the real application, I have many 'view activity' that will call B, but all these should adjust this setting.
I use JDeveloper 11.1.1.4.
Thanks in advance,
BaudelHello
This is because PageDef B represents a link container that is not active at the same time you try to call it. The link container becomes available when you navigate to the page, but not before. Instead:
1. define a bean managed pageFlowScope and expose a Set/getter accessor method to contain the value to pass
2. the bean managed pageFlowScope property reference of NDValue attributebinding using EL
3 set the managed bean before you navigate to view BFrank
-
How to pass a dynamic value to display the criteria
Hello
I have a requirement to indicate the hierarchy. Here, I want to spend the connected in the id of the Manager to the view criteria so that the hierarchy can change based on the connected Manager.
Can anyone help how can I accompolish this.
Can I use the binding variable to pass the value to display the criteria?If you get the Director based on the user id, you can run the display criteria based on the user, as follows:
http://jobinesh.blogspot.com/2010/10/how-to-set-bind-variable-values-at.htmlEnsure that the method is executed until the viewer of the hierarchy is responsible.
Thank you
Nini -
How to set up default InDesign CS5 in the system with InDesign CS4 has the default value?
How to set the application default .indd InDesign CS5 when you installed CS5 and InDesign CS4 and InDesign CS4 is the current default (InDesign CS4 has been installed after the installation of CS5)
Thanks, but I already tried at first, but is not effective.
I think that its because of this reason:
The two - InDesign CS4 and InDesign CS5 have their application/program/exe named "indesign.exe".Installation of either InDesign CS4 or InDesign CS5, sets a default for the 'indesign.exe' Windows path. In this case, since InDesign CS4 was installed later (after InDesign CS5 was already installed), the "indesign.exe" which has been staged "Indesign.exe" of InDesign CS5 has been replaced by "Indesign.exe" of InDesign CS4.
But after long google and searching through regedit, I have the solution:
- Search for HKEY_CLASSES_ROOT\InDesign.Document\Shell\Open\Command in regedit
- Change the value of the attribute (default) for "C:\Program Files (x 86) \Adobe\Adobe" '%1' / / including the quotes
Post edited by: Vidit Kothari
Maybe you are looking for
-
Hello, I am using windows vista with firefox 3.6.6 I could listen to the BBC radio, but later on upgrade Firefox I can't do. Given that this log and error 'enable javascript' despite the fact that it is activate. I need play BBC with another web brow
-
I can only download the windows version. Mac link is broken. Please correct.
-
Pavilion Elite HPE 450 t: replacement ati radeon 5570 what info I have to shop with
Hi, my ATI Radeon HD 5570 has pretty much gone for good. I want to to replace it with something equal or superior performance... but I don't know what I'm looking for when it comes to choosing the size, power and others. I'm running the 64-bit Int
-
Control Panel does not not in windows vista
I have windows vista Basic... when I open the Control Panel, windows Explorer stops responding... and after you close the program if I start again, it works fine... (the same thing happens to the center of the network) I m not able to understand... s
-
Problems with the help of Menu
When I create a navigation bar, I don't see the menu on ERS line box. Only the brand LHSWhy is this?