Customizing af:query

Hi,
Is it possible to customize af:query component? To be precise, I need to translate Search and Reset buttons as well as Match All/Any radio buttons.
Thanks,
Goran

I have tried to create my own class and did everything like in example in the book, but it doesn't work.
Here are my steps (maybe I'm doing something wrong):
- created class SkinBundle that extends ListResourceBundle
- defined af_query.SEARCH = xxxyyy
- created trinidad-skins.xml
- defined new skin as
<skin>
<id>ts.query</id>
<family>ts</family>
<render-kit-id>org.apache.myfaces.trinidad.desktop</render-kit-id>
<bundle-name>mypackage.SkinBundle</bundle-name> //also tried with org.apache.myfaces.trinidaddemo.resource.SkinBundle - nothing
</skin>
- changed trinidad-config.xml tag <skin-family> to ts
I have also tried to add <extends>fusion</extends> but still no luck.
Everytime application uses simple skin, and of course, search and reset button remained in English.
Is there any other way to do this (not thinking of javascript :))?
Thanks
Goran

Similar Messages

  • How can I use the Rownum/Customized SQL query in a Mapping?

    Hi,
    * I need to use a Rownum for populating one of the target field? How to create a mapping with Rownum?
    * How can I use an Dual table in OWB mapping?
    * Can I write Customized SQL query in OWB? How can I achieve this in a Mapping?
    Thanks in Advance
    Kishan

    Hi Niels,
    As I'm sure you know, the conundrum is that Reports doesn't know how many total pages there will be in the report until it is all done formatting, which is too late for your needs. So, one classical solution to this problem is to run the report twice, storing the total number of pages in the database using a format trigger, and throwing away the output from the first run when you don't know the total number of pages.
    Alternatively, you could define a report layout so that the number of pages in the output is completely predictable based upon, say, the number of rows in the main query. E.g., set a limit of one, two, ... rows per page, and then you'll know how many pages there will be simply because you can count the rows in a separate query.
    Hope this helps...
    regards,
    Stewart

  • Can we implement the custom sql query in CR for joining the two tables

    Hi All,
    Is there anyway to implement the custom sql query in CR for joining the two tables?
    My requirement here is I need to write sql logics for joining the two tables...
    Thanks,
    Gana

    In the Database Expert, expand the Create New Connection folder and browse the subfolders to locate your data source.
    Log on to your data source if necessary.
    Under your data source, double-click the Add Command node.
    In the Add Command to Report dialog box, enter an appropriate query/command for the data source you have opened.
    For example:
    SELECT
        Customer.`Customer ID`,
        Customer.`Customer Name`,
        Customer.`Last Year's Sales`,
        Customer.`Region`,
        Customer.`Country`,
        Orders.`Order Amount`,
        Orders.`Customer ID`,
        Orders.`Order Date`
    FROM
        Customer Customer INNER JOIN Orders Orders ON
            Customer.`Customer ID` = Orders.`Customer ID`
    WHERE
        (Customer.`Country` = 'USA' OR
        Customer.`Country` = 'Canada') AND
        Customer.`Last Year's Sales` < 10000.
    ORDER BY
        Customer.`Country` ASC,
        Customer.`Region` ASC
    Note: The use of double or single quotes (and other SQL syntax) is determined by the database driver used by your report. You must, however, manually add the quotes and other elements of the syntax as you create the command.
    Optionally, you can create a parameter for your command by clicking Create and entering information in the Command Parameter dialog box.
    For more information about creating parameters, see To create a parameter for a command object.
    Click OK.
    You are returned to the Report Designer. In the Field Explorer, under Database Fields, a Command table appears listing the database fields you specified.
    Note:
    To construct the virtual table from your Command, the command must be executed once. If the command has parameters, you will be prompted to enter values for each one.
    By default, your command is called Command. You can change its alias by selecting it and pressing F2.

  • Optimize query results(timing) returned from custom search query

    Casey can you send the following to Oracle Support as soon as you can, we need their input on optimizing returning search results.
    To Oracle:
    We have noticed in the IdocScript reference guide that there is a way to optimize the query results returning to the user.
    Here is the scenario: We have created a custom web query where we send a query to the UCM and return a result using a custom template via url like so
    http://dnrucm.dnr.state.la.us/ucm/idcplg?IdcService=GET_SEARCH_RESULTS&QueryText=dDocTitle <matches> `AGREEMENT` <AND> xStateLeaseNum<matches>`00340`&ResultCount=30&SortOrder=Desc&SortField=dInDate&urlTemplate=/ucm/groups/public/documents/oos/hcst-search.hcst
    This works fine. The problem is that when a query is broader like
    http://dnrucm.dnr.state.la.us/ucm/idcplg?IdcService=GET_SEARCH_RESULTS&QueryText= xStateLeaseNum<matches>`00340`&ResultCount=30&SortOrder=Desc&SortField=dInDate&urlTemplate=/ucm/groups/public/documents/oos/hcst-search.hcst
    The query takes an extremely long time to execute and the results template sometimes never comes back, which seems like a timeout.
    Is there something else that we can do to optimize the query results?

    Hi John,
    What version of xMII are you using?
    Some things I would try:
    1. Clear the Java Web Start Cache - see if that makes any difference.
    2. If not, what happens if you save the query under a different name, and then try using it in a new transaction?
    3. Please feel free to enter you case into xMII Support via the SAP Support Portal if you are unable to make this work.
    Kind Regards,
    Diana Hoppe

  • Parameter passing to custom SQL query using PL/SQL FUNCTION

    Hi
    In order to pass a parameter to the query in custom folder of a business area I created a function and mapped it to the Custome query using Discoverer Desktop. There is no error in mapping as the system does not throw any error. When I am inputting the Parameter for the input values everytime the query doesnot return any rows.
    Can anybody help in this regard

    Hi,
    I need to take the request Id as input from the user and then fetch only the data pertaining to that requet Id. As a lot of complex joins are involved I need to pass request id as parameter to the custome folder.
    The package i greated:
    CREATE OR REPLACE PACKAGE SETPARAM
    AS
    param1 varchar2(25);
    param2 varchar2(25);
    FUNCTION SET_PARAM1(p1 IN varchar2) RETURN NUMBER ;
    FUNCTION GET_PARAM1 RETURN varchar2;
    END SETPARAM;
    CREATE OR REPLACE PACKAGE BODY SETPARAM AS
    FUNCTION SET_PARAM1(p1 IN varchar2) RETURN NUMBER IS
    BEGIN
    fnd_client_info.set_org_context('138');
    param1 := p1;
    dbms_output.put_line(param1);
    RETURN 1;
    END;
    FUNCTION GET_PARAM1 RETURN varchar2 AS
    BEGIN
    RETURN param1;
    END;
    END SETPARAM;
    I registered the set_param1 function as a pl/sql function in discoverer admin.
    This function is called on the condition associated with the parameter in Discoverer Desktop when i run the report.
    In the custom folder query i have this piece in the where clause
    WHERE tnfo.request_id = NVL(APPS.SETPARAM.GET_PARAM1,7383588)
    And everytime i get the data pertaining to request id =7383588,
    Please suggest where i went wrong
    thanks
    Ashwini

  • Customer Ageing query

    Hi
    We have a standard query in BW for customer ageing query 0FIAR_C03_Q0002.
    In this query we have several dates
    1. Document date
    2. Posting date
    3. Base line date
    4. Net due date.
    Its very tough to understand what is the significance of these dates and how the query is calculated based on which date. I am finding it difficult to xplani to the client about this report.
    Can anyone explain me about these dates and how the query is calculated on which date.
    Regards
    Annie

    Hi
    When i execute the query, there is a variable called KEY DATE(*). What is that date. When i see in the query designer, there is no variable specified in filter, free characteristics or Rows. Then from where is this varialbe is getting popping up.
    and when i enter a date, how it is going to calculate. I am very much confused. need your inputs.
    Regards
    Annie

  • Possible to execute custom SQL query?

    Is it possible to execute a custom SQL query and get back a collection of
    objects with Kodo JDO? Query expression languages like JDOQL are all very
    well (I actually think JDOQL is pretty messy), but sometimes when you've
    got a complex query (and you know you're using a RDBMS) it is best
    accomplished in a SQL statement. I see Kodo has extended JDOQL, which is
    good, but developing custom extensions seems to be limited to implementing
    kodo.jdbc.query.JDBCFilterListener where you can customise the where
    clause. What I want to be able to do is to specify the entire SQL string.
    I am looking into using Kodo JDO for my organisation, and being able to
    use custom SQL is something i would expect (and something we can do with
    our current O/R mapping product (TopLink)).
    Regards,
    Alex

    Patrick Linskey wrote:
    On Tue, 30 Sep 2003 10:57:13 +0000, Alex wrote:
    being able to use custom SQL is something i would expect
    We absolutely agree. Take a look at the samples/customSQL example in the
    Kodo distribution.
    -Patrick
    Patrick Linskey
    SolarMetric Inc.Hi Patrick,
    I have downloaded kodo-jdo-3.0.0RC1 for windows for evaluation, but there
    is no samples/customSQL directory.
    Alex.

  • Execute custom SQL query in OIM11g

    Hi,
    Can you please provide me some java code snippet to execute a custom sql query and also to get db connection to execute this query in OIM 11g. I am going to run this query in an adapter.
    Thanks a lot for ur help.
    Mike

    Hey Mike,
    Use the below sample code to get db connection and then to execute a query in OIM11g.
    String query = "SELECT UD_ADUSER_EMAIL FROM UD_ADUSER WHERE upper(UD_ADUSER_UID) like '%TESTU%'";
    Connection con = Platform.getOperationalDS().getConnection();
    PreparedStatement preparedStatement = con.prepareStatement(query);
    ResultSet resultSet = preparedStatement.executeQuery();
    while(resultSet.next())
    System.out.println("Output:"+resultSet.getString(1));
    }

  • Incorrectly read attributes with custom SQL query

    Hi folks,
    I'm trying to read in a random sampling of records from a table, so I tried:
    ReadAllQuery q = new ReadAllQuery();
    q.setReferenceClass(Foo.class);
    q.addPartialAttribute("bar");
    q.setSQLString("select * from Foo sample(10)");
    q.useCursoredStream(100,100, new ValueReadQuery("select count(*) from Foo sample(10)"));
    This all worked fine, the Foos were retrieved, but after the first dozen or so, all the "bar" attributes were null, which they should not be. This only occurs when using a custom SQL string. I tried bringing back all the objects (i.e., without using setSQLString) and examining them and all the "bar"s were present. But when I use setSQLString the attributes don't get read correctly.
    Can anyone tell me what I'm doing wrong? Is there a better way to do it?
    Thanks,
    Bryn

    Okay, here's the actual code:
    ReadAllQuery q = new ReadAllQuery();
    q.setReferenceClass(ActivityCenter.class);
    boolean useCustom = true;
    if (useCustom) {
    q.setSQLString("SELECT SetupDt, TerminationDt, ReinstateDt, IID, upDt, ID, " +
    "Stat, SubType, Acct FROM ACtr");
    q.useCursoredStream(100,100, new ValueReadQuery("select count(IID) from actr"));
    } else {
    q.useCursoredStream(100,100);
    session.logMessages();
    activityCenters = (CursoredStream) session.executeQuery(q);
    ActivityCenter ac = (ActivityCenter) activityCenters.read();
    if (ac.getAccount() == null) {
    System.err.println(ac.getID() + ": Oops!");
    } else {
    System.err.println(ac.getID() + ": Has account!");
    System.exit(0);
    So, everything about this program is the same - how the mapping is done, how things get initialized, everything. The only difference is whether I use a custom SQL query or not. Here's what it looks like when I run it both ways:
    First, custom:
    DatabaseSession(2433702)--Connection(393272)--SELECT SetupDt, TerminationDt, ReinstateDt, IID, upDt, ID, Stat, SubType, Acct FROM ACtr
    1.1: Oops!
    Now, without the custom SQL:
    DatabaseSession(393272)--Connection(7896086)--SELECT SetupDt, TerminationDt, ReinstateDt, IID, upDt, ID, Stat, SubType, Acct FROM ACtr
    DatabaseSession(393272)--Connection(7896086)--SELECT
    //bunch of fields from the Acct attribute...
    FROM Acct WHERE (IID= 'ffbe5c47f3ea762cfd50fbe9e6d6de6')
    1.1: Has account!
    Notice that the first query on Actr is identical in both cases. Also note there are no null Actr.acct fields in the database:
    SQL> select * from actr where actr.acct is null;
    no rows selected
    SQL>
    This is on Oracle 9i, with the thin jdbc driver.
    Also, I was curious that you asked if I was using partial attributes - when I try to add a partial attribute when using the custom SQL string, I get exceptions like this one:
    java.lang.ClassCastException: oracle.toplink.internal.queryframework.CallQueryMechanism
    at oracle.toplink.queryframework.ObjectLevelReadQuery.initializeDefaultBuilder(Unknown Source)
    at oracle.toplink.queryframework.ObjectLevelReadQuery.getExpressionBuilder(Unknown Source)
    at oracle.toplink.queryframework.ObjectLevelReadQuery.addPartialAttribute(Unknown Source)
    at jenkon.magellan.util.MLMulator.getActivityCenters(MLMulator.java:782)
    at jenkon.magellan.util.MLMulator.run(MLMulator.java:897)
    at jenkon.magellan.util.MLMulator.main(MLMulator.java:943)
    Thanks,
    Bryn

  • Open invoice customer ageing query

    I have set up a query to find a customer aging report - open ivoices. I just want to have open records... does anyone have a better query for this?
    SELECT     TOP (100) PERCENT dbo.OCRD.CardName, dbo.OCRD.Balance, (CASE WHEN DATEDIFF(DD, T0.REFDATE, GETDATE()) BETWEEN 0 AND
                          30 THEN CASE WHEN T1.SYSCred <> 0 THEN T1.SYSCred * - 1 ELSE T1.SYSDeb END ELSE 0 END) AS [0-30], (CASE WHEN DATEDIFF(DD, T0.REFDATE, GETDATE())
                          BETWEEN 31 AND 60 THEN CASE WHEN T1.SYSCred <> 0 THEN T1.SYSCred * - 1 ELSE T1.SYSDeb END ELSE 0 END) AS [31-60], (CASE WHEN DATEDIFF(DD,
                          T0.REFDATE, GETDATE()) BETWEEN 61 AND 90 THEN CASE WHEN T1.SYSCred <> 0 THEN T1.SYSCred * - 1 ELSE T1.SYSDeb END ELSE 0 END) AS [61-90],
                          (CASE WHEN DATEDIFF(DD, T0.REFDATE, GETDATE()) > 91 THEN CASE WHEN T1.SYSCred <> 0 THEN T1.SYSCred * - 1 ELSE T1.SYSDeb END ELSE 0 END) AS [90+],
                          dbo.OCRD.CardType, T1.TransType, T1.TransCode, T1.LineMemo, T1.BaseRef, dbo.OCRD.CardCode, T1.BalDueDeb
    FROM         dbo.OJDT AS T0 INNER JOIN
                          dbo.JDT1 AS T1 ON T1.TransId = T0.TransId INNER JOIN
                          dbo.OCRD ON dbo.OCRD.CardCode = T1.ShortName
    WHERE     (dbo.OCRD.Balance >= 1) AND (dbo.OCRD.CardType = 'C') AND (T1.BalDueDeb > 0)
    ORDER BY dbo.OCRD.CardName
    Regards,
    knut

    Knut,
    Try this:
    SELECT T2.CardName, T2.Balance,
    (CASE WHEN DATEDIFF(DD, T0.REFDATE, GETDATE()) BETWEEN 0 AND
    30 THEN CASE WHEN T1.SYSCred != 0 THEN -T1.SYSCred ELSE T1.SYSDeb END ELSE 0 END) AS '0-30',
    (CASE WHEN DATEDIFF(DD, T0.REFDATE, GETDATE()) BETWEEN 31 AND
    60 THEN CASE WHEN T1.SYSCred != 0 THEN -T1.SYSCred ELSE T1.SYSDeb END ELSE 0 END) AS '31-60',
    (CASE WHEN DATEDIFF(DD, T0.REFDATE, GETDATE()) BETWEEN 61 AND
    90 THEN CASE WHEN T1.SYSCred != 0 THEN -T1.SYSCred ELSE T1.SYSDeb END ELSE 0 END) AS '61-90',
    (CASE WHEN DATEDIFF(DD, T0.REFDATE, GETDATE()) >90
    THEN CASE WHEN T1.SYSCred != 0 THEN -T1.SYSCred ELSE T1.SYSDeb END ELSE 0 END) AS '90+',
    T1.TransType, T1.TransCode, T1.LineMemo, T1.BaseRef, T2.CardCode
    FROM dbo.OJDT T0
    INNER JOIN dbo.JDT1 T1 ON T1.TransId = T0.TransId
    INNER JOIN dbo.OCRD T2 ON T2.CardCode = T1.ShortName
    WHERE (T2.Balance >= 1) AND (T2.CardType = 'C') AND (T1.BalDueDeb != T1.BalDueCred)
    Thanks,
    Gordon

  • Issue in running GTC having Customized & native query

    Hi Experts,
    We are creating "OIM 9.1 - OIM11g SYNC GTC". When Scheduled task is run, this GTC should be updating the records of OIM11g by taking the data from OIM 9.1 DB.
    We have used the following connection parameters:
    Specify Parameter Values Change
    Database Driver oracle.jdbc.driver.OracleDriver
    Database URL jdbc:oracle:thin:@***************:1521:oimusdb
    Database User ID oimdev
    Database Password ********
    Customized Query (USRIMPORT.USR_EMP_TYPE='Employee' or USRIMPORT.USR_EMP_TYPE='Contractor') and USRIMPORT.USR_STATUS<>'Deleted'
    Use Native Query Yes
    Connection Properties
    Parent Table/View Name USRIMPORT
    Child Table/View Names
    Unique Attribute USR_KEY
    Timestamp Attribute USR_CREATED
    Database Date format
    Batch Size All
    Stop Reconciliation Threshold None
    Stop Threshold Minimum Records None
    Source Date Format yyyy/MM/dd HH:mm:ss z
    Reconcile Deletion of Multivalued Attribute Data No
    Reconciliation Type Incremental
    While running the GTC we are getting following error in logs:
    [XELLERATE.GC.FRAMEWORKRECONCILIATION] [tid: OIMQuartzScheduler_Worker-4] [userId: oiminternal] [ecid: 0000JIbnbxk7u1ADrb4ioY1F10jR000002,0] [APP: oim#11.1.1.3.0] Reconciliation Encountered error: [[
    com.thortech.xl.gc.exception.ProviderException: For non-native customized query, please use & for AND and | for OR.
    at com.thortech.xl.gc.impl.recon.DBReconTransportProvider.getCustomizedQueryCondition(Unknown Source)
    For resolving the above issue, we have tried following combinations: (WHICH ARE NOT WORKING TILL NOW)
    1. Scenario 1:
    query: (USRIMPORT.USR_EMP_TYPE='Employee' | USRIMPORT.USR_EMP_TYPE='Contractor') & (USRIMPORT.USR_STATUS='Disabled' | 'USRIMPORT.USR_STATUS='Active')
    USE NATIVE QUERY = 'NO'
    ERROR: [XELLERATE.GC.FRAMEWORKRECONCILIATION] [tid: OIMQuartzScheduler_Worker-4] [userId: oiminternal] [ecid: 0000JIbnbxk7u1ADrb4ioY1F10jR000002,0] [APP: oim#11.1.1.3.0] Reconciliation Encountered error: [[
    com.thortech.xl.gc.exception.ProviderException: For non-native customized query, please use & for AND and | for OR.
    at com.thortech.xl.gc.impl.recon.DBReconTransportProvider.getCustomizedQueryCondition(Unknown Source)
    2. Scenario 2:
    query- (USRIMPORT.USR_EMP_TYPE='Employee' OR USRIMPORT.USR_EMP_TYPE='Contractor') AND (USRIMPORT.USR_STATUS='Disabled' OR 'USRIMPORT.USR_STATUS='Active')
    USE NATIVE QUERY ='yes'
    ERROR:
    class/Method: DBFacade/getRecord encounter some problems: ORA-00920: invalid relational operator[[
    java.sql.SQLSyntaxErrorException: ORA-00920: invalid relational operator
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:457)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
    3. Scenario 3:
    query- (USRIMPORT.USR_EMP_TYPE='Employee' OR USRIMPORT.USR_EMP_TYPE='Contractor') AND (USRIMPORT.USR_STATUS='Disabled' OR 'USRIMPORT.USR_STATUS='Active')
    USE NATIVE QUERY='NO'
    ERROR:
    ERROR] [] [XELLERATE.GC.FRAMEWORKRECONCILIATION] [tid: OIMQuartzScheduler_Worker-6] [userId: oiminternal] [ecid: 0000JIbnbxk7u1ADrb4ioY1F10jR000002,0] [APP: oim#11.1.1.3.0] Reconciliation Encountered error: [[
    com.thortech.xl.gc.exception.ProviderException: For non-native customized query, please use & for AND and | for OR.
    at com.thortech.xl.gc.impl.recon.DBReconTransportProvider.getCustomizedQueryCondition(Unknown Source)
    at com.thortech.xl.gc.impl.recon.DBReconTransportProvider.getQueryCondition(Unknown Source)
    at com.thortech.xl.gc.impl.recon.DBReconTransportProvider.getFirstPage(Unknown Source)
    Please guide me on the same.

    Hi,
    Thanks for this but i have done as per this document. while running i came to know that there are 2 executable programs in the same name. so i need to remove the one executable program then i run this concurrent program to confirm it. that really we achieved it or not.
    Awaiting for your reply
    Thanks
    M.K.Thamaraiselvan.

  • Customer master Query report doesnt pick all the customer account groups

    Hello experts
    We have a custom Query report created using customer master tables KNA1,KNVV,KNB1 etc. We have customers maintained under 5 customer account groups. One of the selection fields in the query is account group. But it displays customers only in 4 of the 5 account groups for some reason, even though we have customers maintained in that group(prospective customers).
    Any reason why this could occur? How do i ensure that customers from all account groups are visible?
    Thanks in advance

    Hai Ravi
    In SAP query if you join
    KNA1 - KNB1- KNVV
    General - Sasles data - company data
    May be your 5th Account type is created without company code data.
    The query will display only if the data is linked in all tables.
    In case if you don't have company code data but you want the details of the account group customer
    In the query join screen.
    Right click on the joining line between KNB1 and KNVV  and select Left outer join.
    Now run the report , it will show all the account group data.
    Regards,
    Mani

  • Custom Report Query - Patches install on specific computer AND date installed

    I'm looking to create a 2 custom reports that show installed.  I have a similar report already but it shows patches needing to be installed.
    Devices in a collection with columns for total number security patches installed (I'll break them out further by severity) 
    Breakdown of each patch installed on a computer (from report 1) and the date installed. (may also include severity, KB article, description etc.  I already have these fields)
    Essentially I'm looking for the query to pull this data and add to an existing report format I'm already using.
    Ideas?

    Garth,  
    Thanks for the reply.  I've flipped the 2->3 in the report and that gave me what I needed.  
    The other piece was the date installed. This was not in either report.  I did however find it under the database view ucsa.LastStatusChangeTime which my report was already pulling.

  • Customer Attrition Query

    Hi all, I'm hoping someone can suggest the best approach to my issue.
    I'm trying to write a query to analyse the retention of customer purchases for each given month. So given a simple purchase order table (Sales), which contains each purchase a customer has made I want to derive a status for a customer against each month,
    the derived status has to show whether the customer has made a purchase in the previous month and in the current month, or if they have made a purchase in the previous month but not in the current month etc... the stauses can be arbitrary e.g., retained, returning
    or similar...
    The query will run on a table with millions of rows so has to be effiicient and I can't use any temp tables, pivot or partition functions and will probably have a left join with a calendar dimenion table.
    Initial thoughts are obviously a self join with a (month -1) condition but can't think of how to determine previous month and past activity to relate the each current month.
    Many thanks in advance!!!
    Here is a very simple sample table,
    CREATE TABLE [dbo].[SALES](
    [SALE_DATE] [date] NULL,
    [USERID] [int] NULL,
    [INVOICE_AMOUNT] float NULL,
    [SALE_YEAR_MONTH] [int] NULL,
    ) ON [PRIMARY]
    GO
    INSERT [dbo].[SALES] ([SALE_DATE], [USERID], [INVOICE_AMOUNT], [SALE_YEAR_MONTH]) VALUES ('2012-01-02', 8, 33, 201201)
    INSERT [dbo].[SALES] ([SALE_DATE], [USERID], [INVOICE_AMOUNT], [SALE_YEAR_MONTH]) VALUES ('2013-01-01', 8, 232, 201301)
    INSERT [dbo].[SALES] ([SALE_DATE], [USERID], [INVOICE_AMOUNT], [SALE_YEAR_MONTH]) VALUES ('2013-01-02', 8, 54, 201301)
    INSERT [dbo].[SALES] ([SALE_DATE], [USERID], [INVOICE_AMOUNT], [SALE_YEAR_MONTH]) VALUES ('2013-02-02', 8, 122, 201302)
    INSERT [dbo].[SALES] ([SALE_DATE], [USERID], [INVOICE_AMOUNT], [SALE_YEAR_MONTH]) VALUES ('2014-01-01', 8, 75, 201401)
    INSERT [dbo].[SALES] ([SALE_DATE], [USERID], [INVOICE_AMOUNT], [SALE_YEAR_MONTH]) VALUES ('2014-01-02', 8, 333, 201401)
    INSERT [dbo].[SALES] ([SALE_DATE], [USERID], [INVOICE_AMOUNT], [SALE_YEAR_MONTH]) VALUES ('2014-01-03', 8, 3325, 201401)

    >> I'm trying to write a query to analyze the retention of customer purchases for each given month. So given a simple purchase order table (Sales), which contains each purchase a customer has made I want to derive a status for a customer against
    each month, the derived status has to show whether the customer has made a purchase in the previous month and in the current month, or if they have made a purchase in the previous month but not in the current month etc... the statuses can be arbitrary e.g.,
    retained, returning or similar..<<
    Why do you think that “can be arbitrary” is a clear spec that we can use to write Code????
    Thanks you for the DDL, but it stinks and has to be thrown out. You have no key, illegally use FLOAT for money, have a redundant year_month column. We sell to customers, not users. Here is my guess at a skeleton: 
    CREATE TABLE Sales
    (sale_date DATE DEFAULT CURRENT_TIMESTAMP NOT NULL,
     customer_id CHAR(16) NOT NULL,
     PRIMARY KEY (sale_date, customer_id),
     invoice_amount DECIMAL(12,2) NOT NULL
     CHECK (invoice_amount >= 0.00));
    Since SQL is a database language, we prefer to do look ups and not calculations. They can be optimized while temporal math messes up optimization. A useful idiom is a report period calendar that everyone uses so there is no way to get disagreements in the DML.
    The report period table gives a name to a range of dates that is common to the entire enterprise. 
    CREATE TABLE Month_Periods
    (month_name CHAR(10) NOT NULL PRIMARY KEY
     CHECK (month_name LIKE '[12][0-9][0-9][0-9]-[01][0-9]-00'),
     month_start_date DATE NOT NULL,
     month_end_date DATE NOT NULL,
      CONSTRAINT date_ordering
        CHECK (month_start_date <= month_end_date),
    etc);
    These report periods can overlap or have gaps. I like the MySQL convention of using double zeroes for months and years, That is 'yyyy-mm-00' for a month within a year and 'yyyy-00-00' for the whole year. The advantages are that it will sort with the ISO-8601
    data format required by Standard SQL and it is language independent. The pattern for validation is '[12][0-9][0-9][0-9]-00-00' and '[12][0-9][0-9][0-9]-[01][0-9]-00'
    Here is the correct syntax for INSERT INTO; that old Sybase stuff has been dead for several releases. 
    INSERT INTO Sales (sale_date, customer_id, invoice_amount) 
    VALUES ('2012-01-02', '00008', 33.00)
           ('2013-01-01', '00008', 232.00),
           ('2013-01-02', '00008', 54.00),
           ('2013-02-02', '00008', 12.00),
           ('2014-01-01', '00008', 75.00),
           ('2014-01-02', '00008', 333.09);
    WITH 
    X (customer_id, month_name, month_invoice_tot
    AS
    (SELECT S.customer_id, M.month_name, SUM(invoice_amount) 
      FROM Month_Periods AS M, Sales AS S
     WHERE S.sales_date BETWEEN M. month_start_date AND M.month_end_date
     GROUP BY S.customer_id, M.month_name)
    SELECT customer_id, month_name, month_invoice_tot,
           LAG (month_invoice_tot)
            OVER (PARTITION BY customer_id ORDER BY month_name)
            AS prior_month_invoice_tot
     FROM X;
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Bug : Customizing af:query component

    Hi,
    I am using jdev 11.1.1.6.0 version. I want to know how i can customize the error messages displayed by an af:query component. Example: suppose i am using advanced search on a field called productId. The search criteria used is 'Between' and if i mention only one value in the text field and the other text field is empty. Error message pops up saying that Attribute ProductId is required. I want to customize this message with my own error message. How can i achieve this ?
    Thanks in advance.

    check [url http://docs.oracle.com/cd/E12839_01/web.1111/b31974/bcadvgen.htm#BABEFGCI]Customizing Business Components Error Messages

  • Count the number of customer in query designer

    Dear Friends,
    I am trying to create a query where we have two key figures.
    ( Division )      (Total Customer)        (Total Customer who purchase)
    10                      10                                 5
    20                       20                              15
    This means i need two figures one is total number of customer against
    each division irrespect of sales either they purchase somthing or not means read from
    master data.
    and second figure i need total number of customer who purchase
    from us by eash division.
    second KF is achived by creating a  New Formula and put 1 in detail view and
    in aggregation tab i select total option and in ref. char. i choose division.
    now i am getting right number of customer who purchased from us.
    for KF one  i dont know how can we read from master data for customer count.
    i know there is a option for characterstics in advance properties choose from
    transaction data or from master data but i am unable to build logic for counting using
    these advance features.
    any help higly appricated.
    Regards,
    Malik
    Edited by: Malik Naeem on Jan 20, 2009 9:01 AM

    HI,
    Maintain the Total Customer as an attribute..
    Then this characteristic has the values from master data..
    THen Convert this characteristic into key figure using Formula Variable with Replacement path.
    Using Formula varaible with replacemant path,  we can convert a characteristic into key fure..
    I Hope u can achieve the result now...
    Hope this helps u..
    Best Regards.
    VVenkat..

Maybe you are looking for

  • Can not see new Power Query data sources?

    Hi,  New Power Query can connect to three new data sources: Sybase IQ, Exchange, Dynamics CRM Online http://office.microsoft.com/en-us/excel-help/whats-new-in-power-bi-ha104149776.aspx I just installed the latest Power Query and wanted to connect to

  • IMovie 09 crashes when I try to put titles

    iMovie keeps on crashing and I don't know why. here is the crash log: Process:         iMovie [448] Path:            /Applications/iMovie.app/Contents/MacOS/iMovie Identifier:      com.apple.iMovie8 Version:         8.0.6 (821) Build Info:      iMovi

  • I have tearing with flash and Youtube videos.

    First, my specs. Windows XP Quad Core Nvidia 9600gt DDR3 2GB RAM Browsers: Firefox 3.6.12 and IE7 I have the newest Nvidia Drivers and Adobe Flash 10.1 Well the problem is that I have tearing with flash and videos in Windowed Mode, if I turn the full

  • How to disable ThrottleEvent slowing down

    Hi, I am making original media player using OSMF 2.0. But, I have a problem with my media player when ThrottleEvent fired (moved to hidden tab on browser), the video's sound skips. I read references, and this article http://help.adobe.com/en_US/as3/m

  • Enable XA support in Oracle DB version 10.2.0.1 in prep for OIM installatio

    Trying to setup a development environment for OIM. One of the pre-reqs is to install an Oracle DB and prepare it for use by OIM. I installed Oracle DB 10.2.0.1 on Windows 2003 R2 server and I have run the prepare_xl_db.bat script to prep the DB. Howe