How to fill a dynamic array according to the choice of the Viewer

Hello

I came across a dead end on my page "events".

There is a dynamic array, get the information from a database. Initially, it will display upcoming events.

At this point, my question is this:

* Can fill the dynamic table based on a condition where the current date and the date of the event (as in the comic book) will be compared and if the date of the event is aware of the date, it will appear in the table. Otherwise, it will not.

If I can do it, can someone please help me with the code?

In addition, on the right side of the page there are 3 options for the Viewer:

1. display upcoming events

2 discovered past events

3 search for events by month and year

What I want to do, is that when the viewer clicks on 'past events', the table will be reset and populated by these events, whose date is exceeded.

When the viewer clicks on "upcoming events", the table is reset again and filled with the relevant events.

When the viewer selects a month and a year, the database to find reviews of research.

Can we write this in php? Since I read smwhere that php does not work with onclick functions... I got confused. Cuz in my table data should vary depending on what the Viewer is clicking (coming events/events/research past events). I do not want to create pages for each type of event.

If anyone has a better suggestion to complete this task, please share!

Thank you!

> Can I complete the dynamic table based on a condition if the current date and the event date (as in the comic book)

> will be compared and if the event date is later than the current date, it will appear in the table. Otherwise, it will not.

Of course. Just compare the date field in your database with the current time as returned by the function of date of your DBMS. Assuming you are using MySQL, you would compare your column with the currdate() function and the appropriate use of upper / lower to operators in the WHERE clause. If you don't know what a WHERE clause is then I invite you to learn SQL as soon as possible. You can't build data sites without a basic knowledge of SQL.

> Since I read smwhere that php does not work with onclick functions...

This means that php is a server side, where interactions with the user always occur on the client's site. But that doesn't mean that you can't call action from the side event on the client side server. Certainly, you can and would be.

You should consider adding links to the page of dynamic array passing a querystring to the php script that determine which filter to add in the future WHERE clause to the current date, less, etc..

Also, in the future, please post those questions on the application development forum.

Tags: Dreamweaver

Similar Questions

  • How to fill a dynamic array in the form of Adobe Livecycle with cfpdfform?

    Hi all

    After two days of searching about it without results, I hope someone here can help me.

    The problem:

    I have an Adobe PDF form created with Adobe Livecycle Designer that has a dynamic table inside. The Table1 table consists of a header line with 4-cell text and a data line Row1 with four cells each with a Textfield Cell1 and Cell2, Cell4 Cell3.

    Table 1 is inside a subform mytable. The subform is made to flow and the Row1 the link line repeat for each item of verified data.

    Everything is included in the form1 form standard subform.

    When I use the following code, I assumed that the table should have two rows... because it says it will be dynamic:

    <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > ""
    "< html xmlns ="http://www.w3.org/1999/xhtml">".
    < head >
    < meta http-equiv = "Content-Type" content = text/html"; charset = utf-8 "/ >"
    < title > Untitled Document < /title >
    < / head >

    < body >

    "< cfpdfform action ="fill"source ="test.pdf"destination =" testout.pdf "overwrite ="yes">
    < cfpdfsubform name = "form1" >
    < cfpdfsubform name = "mytable" >
    < cfpdfsubform name = "Table1" >
    < cfpdfsubform name = "Row1" >
    < cfpdfformparam name = "Cell1" value = "1" >
    < cfpdfformparam name = "Cell2" value = "2" >
    < cfpdfformparam name = "Cell3" value = "3" >
    < cfpdfformparam name = "Cell4" value = "4" >
    < / cfpdfsubform >
    < cfpdfsubform name = "Row2" >
    < cfpdfformparam name = "Cell1" value = "5" >
    < cfpdfformparam name = "Cell2" value = "6" >
    < cfpdfformparam name = "Cell3" value = "7" >
    < cfpdfformparam name = "Cell4" value = "8" >
    < / cfpdfsubform >
    < / cfpdfsubform >
    < / cfpdfsubform >
    < / cfpdfsubform >
    < / cfpdfform >


    < cfpdfform action = "read" source = "testout.pdf" result = "testout" / > "
    < cfdump var = "#testout #" >
    < / body >
    < / html >

    What caught is:

    The testout.pdf displays a single row, with values 1,2,3,4 the second row is visible only when I export data in xml format, but not in the PDF file.

    Please can someone enlighten me?

    Thanks and greetings

    Gilbert

    When filling out your fields of pdf, you can search through all the records in a query as follows...


               
               
     

    He will manage two lines or thirty anyway.  In this case my fields in the pdf file have the line # as a suffix.

  • How to build a dynamic array index in the attribute 'to' house arrest

    Hi all

    I need to generate xml output with the appearance of multiples of the same complex element. The number of items is calculated dynamically. I use bpelx: append to add items, but I'm crashes when I try to assign values to elements using a variable to index items.

    How can you dynamically assign an array index variable in the attribute 'to' a copy instruction? I was able to do in the attribute 'from' the copy statement, following the examples indicated in the documentation for the xpath function. But when I use the concept of intermediate variable, I get a compiler error stating that the query attribute must start with ' / '.
    It works fine when I hard code the index in the attribute of "query" in the statement "copy to".

    I use 10.3.3 version JDev and 10.3.3.0 PM BPEL version.

    Here are the two methods I've tried:
    ----------------------
    < copy >
    < expression = "concat ('/ client: assTestProcessResponse / client: ScreeningComments / client: CommentItem [', bpws:getVariableData('notesCount'),'] / client: CommentText')" / >
    < variable = "queryText" / >
    < / copy >
    < copy >
    < expression = "bpws:getVariableData('noteText')" / >
    < variable = part of the 'outputVariable"="payload ".
    Query = "bpws:getVariableData('queryText')" / >
    < / copy >
    ----------------------
    < copy >
    < expression = "bpws:getVariableData('noteText')" / >
    < variable = part of the 'outputVariable"="payload ".
    Query = "/ client: assTestProcessResponse / client: ScreeningComments / client: CommentItem ["bpws:getVariableData(&quot;notesCount&quot;) " ""] / client: CommentText "/ >
    < / copy >

    ----------------------

    Has anyone had a similar problem? Please let me know this is doable and how.

    Thank you
    A.T.

    Hello

    I don't know if the following solution is what you want, but I'll try to explain how this would work; (o)

    I understand your question, you have a following like the watch of simple structure xml schema:

    
      
        
           
        
        
           
        
    
    

    The element is a complex type that has as a child element.
    The element can have 1.. * items

    As you explained that you know how to add loose, common is to use an XML Fragment example

    
      
        
          
            
          
        
        
      
    
    

    As you can see now there are two elements with the child element

    After the task to assign the variable content looks like:

    
      
        
          
            
              
            
            
              
            
          
        
      
    
    

    After adding the fragment, you can set the value for the for the first content element in the following way:

    
      
        
        
      
    
    

    The important thing is to know how to point to the correct position within the payload. It works with that part of the query statement

    [position()=1]
    

    or you can of course use the short version

    [1]
    

    The next task is to dynamically create the reference to the position. Therefore, you can for example use a variable. You can for example something like this:

    
      
        
        
      
    
    

    And the last step is to set the element of content dynamically using the defined variable

    
      
        
        
      
    
    

    The only thing to use the defined variable is that part of the query:

    [position()=bpws:getVariableData('Position_Variable')]
    

    Finally, the XML Structure should look like this:

    
      
        
          
            
              Content1
            
            
              Content2
            
          
        
      
    
    

    Concerning

    Alex

  • My code servlet JasperViewer report mode more download it in pdf in chrome. How to modify this code it gives only the view in JasperViewr?

    Mr President.

    My servlet code does two things

    1 see the report in JasperViewer

    2. it download it in pdf in chrome.

    How to modify this code it gives only the view in JasperViewr?

    My code is

    package esh.view;
    
    
    import esh.model.AppModuleImpl;
    
    
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.PrintWriter;
    
    
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.SQLException;
    
    
    import java.util.HashMap;
    import java.util.Locale;
    import java.util.Map;
    
    
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    
    import net.sf.jasperreports.engine.JasperCompileManager;
    import net.sf.jasperreports.engine.JasperExportManager;
    import net.sf.jasperreports.engine.JasperFillManager;
    import net.sf.jasperreports.engine.JasperPrint;
    import net.sf.jasperreports.engine.JasperReport;
    import net.sf.jasperreports.engine.design.JasperDesign;
    import net.sf.jasperreports.engine.xml.JRXmlLoader;
    
    
    import net.sf.jasperreports.view.JasperViewer;
    
    
    import oracle.jbo.client.Configuration;
    
    
    @WebServlet(name = "MultiReportServletJasper", urlPatterns = { "/multireportservletjasper" })
    public class MultiReportServletJasper extends HttpServlet {
        private static final String CONTENT_TYPE = "text/html; charset=UTF-8";
    
    
        public void init(ServletConfig config) throws ServletException {
            super.init(config);
        }
    
    
        protected Connection getConnection() {
                
                PreparedStatement st = null;
                String amDef = "esh.model.AppModule";
                String config = "AppModuleLocal";
                AppModuleImpl am = (AppModuleImpl ) Configuration.createRootApplicationModule(amDef, config);
                
                st = am.getDBTransaction().createPreparedStatement("select 1 from dual", 0);
                Connection conn = null;    
            
                try {
                    conn = st.getConnection();
                    return conn;
                } catch (SQLException e) {
                }   
            
                return null;
            }
    
    
        public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            String var0 = "";  
            String reportName = "";  
            try {  
                 reportName = request.getParameter("reportName");  
                } catch (Exception e) {  
                        e.printStackTrace();  
                       }  
                 response.setContentType(CONTENT_TYPE);  
                 Map parameters = new HashMap();  
                 parameters.put("format", "pdf");  
                 parameters.put("WEBDIR", getServletContext().getRealPath("/"));  
                 parameters.put("REPORT_LOCALE", new Locale("ar"));                             
                                                                                            
                 Connection conn = null;  
                 InputStream is = null;  
            try  
                {  
                 conn = getConnection();  
                 is = getServletContext().getResourceAsStream("/WEB-INF/reports/"+reportName+".jrxml");  
                              
                             
                 response.setContentType("application/pdf");  
                 response.addHeader("Content-Disposition", "attachment; filename="+reportName+".pdf");                                        
                 JasperDesign jasperDesign = JRXmlLoader.load(is);  
                 JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);  
                 JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, conn);                      
                 JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());  
                 JasperViewer.viewReport(jasperPrint,false);                                                                                
                  conn.close();  
                }  
                   catch (Exception e) {  
                         e.printStackTrace();  
                    } finally {  
                        closeConnection(conn);  
                    try {  
                           if(is !=null){  
                              is.close();  
                         }                                                             
                } catch (Exception localException1)  
                    {  
                      }  
                }                      
        }
        
        protected static void closeConnection(Connection conn) {
                try {
                    if(conn !=null){
                       conn.close();
                    }           
                } catch (Exception ex) {
                    //  System.out.println("Developer Msg : Exception in printReport1Servlet.closeConnection()");
                }
            }
        
        
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    Concerning

    Change: response.addHeader ("Content-Disposition", "attachment; filename = "reportName +".pdf");"

    To: response.addHeader ("Content-Disposition", "inline; filename = "reportName +".pdf");"

    Browser first tries to show the PDF, and if no pdf reader is available, you will get the download dialog box.

    (and remove JasperViewer.viewReport (jasperPrint, false);  )

    Dario

  • List of dynamic members according to the level

    Hello

    Is there a way to create a list of dynamic member in HFM based on the account in the account hierarchy (I'm working on HFM v. 11.1.2.0)? I'm changing the order in which the accounts appear on our studio EN reports, where the total are displayed at the bottom of each detailed section (see example below).

    Other species
    Outstanding cheques
    (tab) Cash
    Money-markets
    Other EQ of cash.
    (tab) Cash equivalents
    (double tab) Total cash and cash equivalents


    The HFM in the order account hierarchy unlike the presentation above, simply adding members based on a flag UD translates a list in reverse order of how I want to see the report. I don't use automatic calculation in EN Studio is because I don't have only one line of data that takes in a list of member set that is based on a field UD (all members above could be labelled with UD). I couldn't realize the calculations under hierarchical with autom

    So, I wanted to make the reversal of the hierarchy in the creation of my lists of members. I thought that if I follow somehow the level of each member number, I could use to overthrow the hierarchy and possibly use it to conditionally format fields as well.

    I'd like suggestions on how to get this working or other alternatives that I can try.

    Thank you!

    Here's a possible solution I came up with my question. The following code creates a list of members that will add accounts in the correct order with parents appear at the bottom of each hierarchy. The code below is for the whole of the balance of the accounts, but it can be used on any other hierarchies as well.

    Void AccountUD2_BalSht()

    HS = ACC. Account.List ("BALANCE_SHEET", "[Descendants]")

    Set arguments array1 = CreateObject ('System.Collections.ArrayList')
    Define array2 = CreateObject ('System.Collections.ArrayList')
         
    ' Assignment of list in a table

    For each a1 within ACC
    HS = UD2Var. Account.UD2 (a1)
    If UD2Var = "TB_Acct".
    Array1.Add a1
    End if
    Next
    y = Array1.Count - 1

    "All members who are declared trial balance lines in the list of members in the correct order of entry
    Do
    TargetAcct = Array1 (i)
    For j = i to o
    If (i) Array1 = Array1 (j) Then

    On the other
    If HS. Account.IsDescendant (TargetAcct, Array1 (j)) then
    TargetAcct = Array1 (j)
    POS = j
    End if
    End if
    Next

    Array2.Add TargetAcct
    Array1.Remove (TargetAcct) "delete the account that has been added to the new list from the original list
    y = y - 1
    Loop While (y > 0)
         
    For each a1 of array2
    HS. AddMembertoList a1
    Next
    HS. AddMembertoList "BALANCE_SHEET".

    End Sub

    Once the list of members was in place, I used EN studio conditionally format the lines I need back. I'd appreciate any suggestions on how to code it better.

    Under the direction of: MR January 31, 2013 14:57

  • Taskflow dynamic array and reset the user interface States

    Hi team.

    I use JDeveloper 11.1.2.4.

    I have a nice flow dynamic bounded task that has a view main activity.  Links to view activity change as part of the workflow.  The workflow is initialized with a navigation event.  The display shows just a table of data corresponding to the navigation event.  The table is sortable.  It all works very well.

    The challenge that I meet is that users do not want details of the sort on the table has persisted between navigation events.  So they select NavA, the query executes against ViewA.  They select NavA, they query executes against ViewB.  The table and the activity of the view are the same.  And, during the navigation, in the framework of task flow not related, the display does not actually change in the region.  It is updated with the appropriate data, but the genre are also persisted.  It feels like the client stores the State of the table that I'm not able to remove the sorting criteria of the Rich Table via a managed bean.  Certainly, it feels like what must be launched from the client instead of a managed bean. I don't want to add buttons to view activity to do the reset, because users want this to be triggered by the navigation event.

    If I spend a dynamic unrelated workflow and to return to the dynamic workflow, so details are reset beautifully.  However, this is not an option for the users.

    Any suggestions on the approach would be appreciated.

    Thank you


    BradW

    OK, so I had to add this feature to my menu:

      public void setResetMainRegion(String regionName){
        if (regionName != null && !"".equals(regionName)){
          UIComponent mainRegion = JSFUtils.findComponentInRoot(regionName);
          RichTable table = (RichTable)JSFUtils.findComponent(mainRegion, "DynamicCodeTablesTab");
          if (table != null){
            List sc = new ArrayList() ;
            table.setSortCriteria(sc);
            AdfFacesContext ctx = AdfFacesContext.getCurrentInstance();
            ctx.addPartialTarget(table);
          }
    
        }
    

    The thing is that we must find the component, as it is extremely difficult to work with PageFlowScoped managed beans that have been created to support tables.  Such a simple fix, it took you a while to understand where the issue should be resolved.  It seems that some of these issues have to keep longer appears outside the BTF.  Not ideal because this introduces too many dependencies.  Trying to minimize as much as we can.

    BradW

  • How to automatically complete a transitional according to the value of another attribute when attribute line is questioned in the VO?

    Hello world

    The task seems simple enough, but I have not found a way to populate an attribute transitional according to the value of another attribute when the line is queried. What is the best way to achieve this?

    Thank you.

    James

    Use VORowImpl, if you have any transient attributes defined in the view object, whose value is derived from other attributes of the line, you can override the GET method and add logic there

    Please note that this class represents a row in the results collection in a display object.

  • 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.html

    Ensure that the method is executed until the viewer of the hierarchy is responsible.

    Thank you
    Nini

  • How to find? in a text of the view (definition) in all schemas

    Hello

    Version of DB Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production
    OS RHES 5U2

    I would appreciate if someone can tell me how to get a list of all views in the database that contains? in the text of the view definition.

    I tried with the two DBA_VIEWS and ALL_VIEWS to aid after the query, but it returned error.

    SELECT MASTER: '. ' || VIEW_NAME
    OF ALL_VIEWS
    WHERE THE TEXT LIKE ' %? %'
    AND the owner not in ('SYS', 'SYSTEM', "SYSMAN", "GENERAL", "OLAPSYS", "MDSYS", "CTXSYS")
    ORDER OF OWNER;
    WHERE THE TEXT LIKE ' %? %'
    *
    ERROR at line 3:
    ORA-00932: inconsistent data types: expected NUMBER got LONG


    SELECT MASTER: '. ' || VIEW_NAME
    FROM DBA_VIEWS
    WHERE THE TEXT LIKE ' %? %'
    AND the owner not in ('SYS', 'SYSTEM', "SYSMAN", "GENERAL", "OLAPSYS", "MDSYS", "CTXSYS")
    ORDER OF OWNER;
    WHERE THE TEXT LIKE ' %? %'
    *
    ERROR at line 3:
    ORA-00932: inconsistent data types: expected NUMBER got LONG

    Thank you

    WHERE THE TEXT LIKE ' %? %'

    The TEXT here is a LONG data type, you cannot use it in an expression.
    You can do this:

    SQL> select count(*) from user_views where text like '%OPRD%';
    select count(*) from user_views where text like '%OPRD%'
                                          *
    ERROR at line 1:
    ORA-00932: inconsistent datatypes: expected NUMBER got LONG
    
    SQL> create table myviews (view_name varchar2(30), text clob);
    
    Table created.
    
    SQL> begin
      2  for i in (select view_name,text from user_views) loop
      3  insert into myviews values (i.view_name,i.text);
      4  end loop;
      5  end;
      6  /
    
    PL/SQL procedure successfully completed.
    
    SQL> select count(*) from myviews where text like '%OPRD%';
    
      COUNT(*)
    ----------
           136
    
    SQL>
    

    Nicolas.

  • How to fill a dynamic role with the members of the ad group

    Hoping someone can help with that I don't know where to start.

    I want to build a dynamic role that pulls in the members of certain groups from Active Directory.  Let's say I have two Active Directory groups: GROUPA and GroupB.  My goal would be to have the dynamic, filled with each group the user role.

    Someone at - it an example of SQL code snippet they could share?

    You can build this quite easily with the wizard:

    Which generates the SQL code:

    (UID_Person in (select UID_Person from the UNSAccount join UNSAccountInUNSGroup on UNSAccount.UID_UNSAccount = UNSAccountInUNSGroup.UID_UNSAccount where (UNSAccount.UID_UNSRoot = no * YOUR UID FIELD *') and (UNSAccountInUNSGroup.UID_UNSGroup in (select UID_UNSGroup in the UNSGroup where cn = is placed '))) and (UID_Person in (select UID_Person in the UNSAccount join UNSAccountInUNSGroup on UNSAccount.UID_UNSAccount = UNSAccountInUNSGroup.UID_UNSAccount where (UNSAccount.UID_UNSRoot = no * YOUR UID FIELD *') and (UNSAccountInUNSGroup.UID_UNSGroup in (select UID_UNSGroup in the UNSGroup where cn = GroupB')))))

  • Sorting algorithm: How can I sort both arrays according to a

    I have two rows parallel, similar to this:

    var array1 = [4, 3, 1, 5, 2];

    var Array2 is ['four', 'three', 'one', 'two', 'five'];.

    I want to sort the first table and the second table followed the same kind as the first. Any advice for a good algorithm would be appreciated.

    Rick Quatro

    This gives a try!

    var array1 = [4, 3, 1, 5, 2];
    var array2 = ["four", "three", "one", "five", "two"];
    
    bubbleSort(array1,array2);
    
    function bubbleSort(a,b)
    {
        var swapped;
        do {
            swapped = false;
            for (var i=0; i < a.length-1; i++) {
                if (a[i] > a[i+1])
                {
                    var temp = a[i];
                    a[i] = a[i+1];
                    a[i+1] = temp;
    
                    var temp = b[i];
                    b[i] = b[i+1];
                    b[i+1] = temp;
                    swapped = true;
                }
            }
        } while (swapped);
    }
    
    alert(array1);
    alert(array2);
    
  • How can I detect dynamically new modules of the cFP-2200?

    Hello

    I'm working on a project that monitors the voltage using the cFP-2200 with any number of PSC-HAVE-102 installed modules. Each analogue channel PSC-HAVE-102 will correspond to its own state machine which tells you a central database.

    I want to create something that does not need to know how the PSC-HAVE-102 s settled in advance. At startup, my software must be able to detect all PSC-HAVE-102 s and dynamically create the State machines for each channel, if I have 1 I-102 (8 analog monitor channels), or the maximum of 8 installed (64 channels to watch).

    Right now, I can only understand how to the program for channels that are currently available by connecting to the module in its current condition and click/drag the analog channels in the project window. Is it possible to program for strings that are not there, but could be later? The application of this is to deploy the module on the ground and have the ability to add or remove I-102 s without changing the installed software.

    kgolden,

    Do you mean that the ini file will be correctly created only if I have the number I-102 s max?  Yes, you must have 8 I-102 in your project as part of the goal of the PSC.  Forcing him to be included in the. The IAK file and in turn to be defined in the .ini causes.  I think you can use the Project Explorer to add modules to the CFP, even if they do not exist physically.

    Is it possible to manually edit the file instead?  I think that it is possible to manually edit the .ini.  I don't know that NEITHER does not bear this manual change.  The question would be is there other on the CFP .ini files that contain references to the i/o modules installed?

  • How to TOGGLE OFA form field according to the conditions

    Dear all,

    I'm new to OAF and started learning the OFA.

    I have a requirement as below,

    The Window(OAF Page) provider, there is a tab named 'key to purchase Setups '.

    Here if the provider's site is already created and 'Pay' and "Level summary invoice" columns is to have values, questioning the site begging, I want to disable (not editable) the two fields 'Invoice Summary Level' and 'Pay' for all users except IE a user Guru

    Using customization, I can put the READ ONLY option, but I need to be implemented for the above condition.

    Can anyone suggest me how to proceed?

    Thank you

    Kind regards

    Guru

    Hello.

    I think that your condition is the same as it

    Dynamically set read-only columns in the tabular presentation at record levels

    I already mentioned solution.

    Same would apply to you.

  • 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.

  • How to map a dynamic/computed column in the annotation of persistence?

    I try to use APP to map the results of a query to a class, but one of the columns returned by the query is the result of a subquery - it has no really a column associated with it.

    Example:

    Select a, b, c,.
    case when it exists (select 1 from some_other_table where...) then 'Y' end ' n else as test_flag
    of une_table
    where the...

    This case statement that performs a subquery to produce a result that is not actually mapped to a physical column so I

    How to mark such a situation, so that roll in hibernation, or anything that fills the a property named testFlag when it loads the results of this query?

    Trant says:
    I try to use APP to map the results of a query to a class, but one of the columns returned by the query is the result of a subquery - it has no really a column associated with it.

    Can you share the code? This seems to be the opposite of what JPA or any ORM package is intended; you would usually the ORM package produce SQL statements based on an object model and a query of high level object, but you try here to feed a sort of a pre-existing query object model. As I said - back. You may want to use executeNativeQuery?

    Whenever I am confronted with a situation where a request starts to do involving the unions, subqueries, etc.. I keep the side JPA as stupid as possible. I create a view on the side of the database and that you simply map my entity to this point of view. With appropriate indexing in place which usually performs very well.

Maybe you are looking for

  • Qosmio G50 - 12R XP drivers for the multimedia keys

    Hello My company bought some Qosmio G50 - 12R notebooks to install professional software. I said, I want mobile computers with Windows XP, but these PCs are on Vista. I tried to install the software on Vista and Windows 7 RC but without success. We d

  • Windows 7 (64 bit) - smartmenu does not

    Hello I have re-installed windows 7 after that hdd has stopped working. I did it to each update (update of windows assistant hp, etc.). But my smartmenu does not work properly. I would like to use keyboard shortcuts for volume control (it works but I

  • €100 on my ID apple lost?

    Heey everybody, Today, I put 100 euros on my apple id account, but to use it, I need to check my security questions, but I don't know the answers more... I tried to send an email to reset responses, but electronic mail are not sent. Help please, than

  • 5540 ENVY: Envy 5540 connect not not Mac El Capitan

    Earlier today, I bought a HP ENVY 5540. I'm trying to install it on my MacBook Pro running Mac OS x 10.11 El Capitan. When I run HP Easy Start, it says "the device is not found on your wireless network. Click on wait to continue searching, or Reconfi

  • From a laptop with VISTA

    When I started my laptop, I got the following message: "updates the configuration, step 3 of 3, 0% complete". It keeps just close and restart with the same message. I tried to l ' turn off and commissioning and pressing F8. Any kind of reboot I try d