Simulate select distinct count sql logic in query or data model

hello experts,
given prerequisites: DSO with flat table without any key figures - just characteristics (about 10)
the requirement is to produce the table with all possible combinations of those characteristics with counting the hits
- this flat table should be then loaded to another system
exmple
char error| char division| char time|char id xxx xxx xxx xxx xxx
some counter should be implemented and all combinations of 10 characteristics counted
example
char error| char division| char time|char id xxxxx  1
char error| empty field| empty field| |char id   5
etc
the output should be flat table with counts on the right - some fields will be empty depending on combinations to be counted
what is the best way - query with RCF or some SQL statements in Transformation? how to implement the output desired
thanks in advance

That sounds very odd.
Can you turn on debug tracing by adding
-Djbo.debugoutput=console
to the Java options of your project (Project Properties, Profiles, Development, Runner)?
Then test the query that is output in the log in SQL*Plus and see if you get the same results.
-SteveA (JDev Team)

Similar Messages

  • Dynamic selection of query in data-model

    I have a report which has 3 disjoint queries in its data model. I have a lexical parameter (:p_where) for all the queries. In the afterform trigger, based on another parameter (:p_type) i am having the where clause built and assigned to the "where lexical parameter". In my layout, i have one repeating frame for each group(query) and displaying the appropriate frame based on the (:p_type).
    What i have acheived here is, based on the :p_type, my where caluse is built and the appropriate frame is displayed. But one problem here is since i am using the same ":p_where" for all the 3 queries, all of them will be executed but since only one frame is visible at a time, user doesnt see the results of the other 2 query though it is executed and fetched.
    Now my question is, is there a way to dynamically select the query to be executed in my datamodel. If so, i can avoid the execution of the all 3 queries always and the report will only execute the required one query based on the :p_type parameter.

    Hi,
    It is better to use Additional layouts if you have disjointed queries which gets the same parameter. This way the user is able to see all the results at a time.
    Regards

  • SQL Developer - problems with the Data Modeller part

    Hi SQL Developer users,
    I can open the Data Modeler pane, but I can't insert any object into the logical model or into the relational model. Any ideas about what I'm doing wrong? Do I need specific privileges to the database, or do I need to install SQL Developer in a different way?
    Thanks,
    Csisz

    Hi Csisz,
    as Ivaylo wrote - it's Data Modeler Viewer into SQL Developer.
    I can't insert any object into the logical model or into the relational modelYou can drag tables from SQL Developer browser and drop them on relational model diagram. If you keep Ctrl key pressed then all child tables also will be imported and shown on diagram.
    Philip

  • How to make linkage query In Data Model for search

    I want to make an linkage query as a condition for my  report in BI Publisher. how to make the linkage in Date Model ?

    This is the forum for SQL Developer, not for general SQL or PL/SQL questions.
    Please repost this in the SQL and PL/SQL forum.

  • How capture query in data model report

    Hi,
    I have multiples queries in my data model report >clause WHERE is dynamic in all queries<. I need capture the final query and look what query execute.
    Is this posible?, Are there any API that I can use? .
    Viktor.

    Viktor,
    you can trace the report including the sql. Look in te builder at the menu program. there's a tracing option.
    Regards
    Rainer

  • How to combine sql queries of two different data models of a single RDF

    Hi All,
    Greetings.
    I am on a task to get  the sql query of a seeded report(Accounting Rules Report) with RDF named RAXARL.rdf
    The RDF consists of 3 data models which consist of a sql query each and they are running fine individually.But I want all those three to be combined in a single SQL Query so that I can use it running  a report in apex.
    Can anyone help me do this? I am able to find a solution for this.
    Thanks in advance,
    Bhaskar.

    Hi Bhaskar,
    To get the SQL behind the report, run it with the Enable Trace option enabled (disable it after you get it).
    Octavio

  • MS SQL Server Indexed View in Data Modeler

    Hi All,
    I'm fairly new to Data Modeler. Tried to search the forums for this but couldn't find anything. I'm trying to figure out how to create (in a SQL Server 2008 physical model) a view with a clustered index in Data Modeler v. 3.3. Seems like it is supported per the below link, however I can't seem to find a reference to it in the application.
    http://www.oracle.com/technetwork/developer-tools/datamodeler/featurelist-167684.html
    Any help would be appreciated!
    Thanks,
    Jeff

    Hi Jeff,
    you need to create/open physical model for MS SQL Server and find view presentation there. Set the view property "Schema Binding" to yes.
    However I see some problems in definition of such index and DDL generation for view and logged a bug for that.
    Philip

  • Where to find logical and/or technical data model?

    Hi all,
    I am new to SAP and trying to figure out where I can best find information on the logical/technical datamodel, including entity/table and field definitions. I also am looking forminfo on primary keys, foreign keys, relationships between entities/tables, data model overviews/graphs. What places should I go to get this information?
    So I am NOT looking for a specific table, I would like to get a general overview of the logical/technical data structure.
    Thanks, Paul

    Hi Paul,
    SAP has several thousands of tables (not including structures, views, etc.) So, an overview look on the whole database would be rather problematic. You can search the http://help.sap.com for the functional info. For the technical one, you can go to SE84 and find the requested info there. I suggest you to explore the technical info concentrating on specific issue, otherwise you will sink in the sea of SAP objects.
    Regards,
    Eli

  • Setting Default value with SQL Query as Data Model

    Hi All,
    I am developing report based on SQL query.date set as 'SQL Query'. I have created two params start-date and end-date. I am fetching records from database between these two dates.
    I want to populate sysdate as a default values. I do not want to use datatemplate approach i mean using beforeReport trigger.
    Thansk,
    Vara

    Hi Vara,
    To set the default value for one of your parameters to SYSDATE you need to enter:
    {$SYSDATE()$}
    in the Default Value text box
    Is this what you require?
    Cheers
    Andy

  • Query about Data Model Design, UPDATED_ON

    hi on a *.ppt called ODTUG2007_Advanced_APEX.ppt, that i found on google <www.oracle.com/technology/products/database/application_express/ppt/ODTUG2007_Advanced_APEX.ppt>, i found a something that might be very interesting in using in my APEX app... it said something about some Standard Columns, and "phrases" (created_by, created_on, updated_by, updated_on) that i would like to see and learn how to implement.
    So i do appreciate if anyone has got an example, or can explain them to me...
    Best regards.
    Jaison González

    Jaison,
    There's another way to do that might work for you:
    1. Create the fields updated_by and updated_on in the table;
    2. Create in the page the items PX_UPDATED_BY and PX_UPDATED_ON of type "Text field (saves state)";
    3. Go to the properties of the item.
    PX_UPDATED_BY
    Source:
    - Source Type: Database column;
    - Source Value or expression: updated_by
    - Post Calculation Computation: :APP_USER
    Default:
    - Default value: &APP_USER.
    PX_UPDATED_ON
    Source:
    - Source Type: Database column;
    - Source Value or expression: updated_on
    Default:
    - Default value: sysdate
    - Default value type: PL/SQL Expression
    When the user submits the changes, the table fields are updated.
    Regards,
    Ricardo Stumpf
    Brasília - Brazil
    Message was edited by:
    Stumpf

  • SQL DISTINCT COUNT IN DATE RANGE

    Dear All
    Thanks for your attention.
    A table is storing the task summary of each order
    e.g.
    Date                            | Order Number    | Task Number
    2015-01-01 00:00:01   | ABC123456        | JOB001
    2015-01-01 00:01:02   | ABC123456        | JOB002
    2015-01-01 00:10:02   | ABC123444        | JOB001
    2015-01-01 10:12:59   | ABC123456        | JOB002   (Since the job002 is not done correctly, need to work again)
    2015-01-01 18:20:05   | ABC888888        | JOB001
    2015-01-01 20:22:42   | ABC789456        | JOB001
    2015-01-01 21:02:11   | BBB121212        | JOB002
    I would like to write a single query that get the distinct count of order number in sepcific date range
    result as expected in three columns:
    2015-01-01
    task_number            | AM | PM
    JOB001         | 2    | 2
    JOB002         | 1    | 1
    explain the figures here:
    JOB001 AM = 2 (ABC123456, ABC123444)
    JOB002 AM = 1  (two records of ABC123456 count as 1 since we would like to know the number of orders)
    JOB001 PM = 2  (ABC888888, ABC789456)
    JOB002 PM = 1  (BBB121212)
    I wrote a query get similar result but the count of order is not distinct
    SELECT task_number,
    AM=SUM(CASE WHEN date >= ('2015-01-01 00:00:00') AND date < ('2015-01-01 12:00:00') THEN 1 ELSE 0 END),
    PM=SUM(CASE WHEN date >= ('2015-01-01 12:00:00') AND date < ('2015-01-02 00:00:00') THEN 1 ELSE 0 END)
    FROM MyTable
    WHERE task_number = 'JOB001'
    Could anyone advise how to enhance this query to let the result become disintct of order number?
    Many Thanks,
    swivan

    Try
    select task_number,
    count(distinct case when datepart(hour, [date]) >=0 and datepart(hour, [date]) < 12 then [OrderNumbers] END) as AM,
    count(distinct case when datepart(hour, [date]) >=12 and datepart(hour, [date]) < 24 then [OrderNumbers] END) as PM FROM myTable
    GROUP BY Task_Number
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles
    Thank you very much,  short and good answer

  • Distinct Count Calculation

    Hello everybody,
    I have a cube with appointments including dimensions for companies and dates.
    One of my measures is "Appointments" which is the count of all appointments. Another calculated member is "Visits" which is the count of appointments with the type of "Visits".
    This is my MDX epxression for "Visits":
    AGGREGATE([Appointment].[Type].&[Visit], [Measures].[Appointments])
    Now I would like to create a new calculated member "Company Visits" which should be the distinct count of "Visits" by company and date.
    Example: 2 "Visits" in one company on the same day should be 1 "Company Visit"
    In T-SQL this query works:
    COUNT(
    DISTINCT(
    CASE [Type]
    WHEN "Visit" THEN CAST([CompanyID] AS NVARCHAR) + CONVERT(NCHAR(8), CAST([Date] AS NVARCHAR))
    ELSE NULL
    END
    ) AS [Company Visits]
    How can I do this with MDX in calculations?
    Additionally I would like to have a calculated member "Days in Field" as distinct count of dates with "Visits".
    Thanks in advance and best regards
    Lars

    Hi Lars,
    Based on your description, you want to create a new calculated member to calculate the distinct count of "Visit" for each company, right? In this case, you can use DistinctCount to achieve your requirement, here is a sample query about DistinctCount function
    for your reqerence.
    with member [DistCount] as
    distinctcount(exists(Employee.Employee.children,,"Reseller Orders"))
    Select {[Measures].[Reseller Order Count],
    [Measures].[DistCount]} on 0,
    ([Employee].[Gender].children) on 1
    From [AdventureWorks]
    Reference:DistinctCount (MDX)
    Regards,
    Charlie Liao
    TechNet Community Support

  • How to undo "select distinct" in OBIEE

    Hello guys
    I found that pretty much in all the reports that we created in OBIEE, the presentation service would generate SQL that starts with "select distinct" when I view the query log..
    I'd like to know what configuration in the Admin Tool or presentation service is controlling this behavior of OBIEE. For some reason as I am tuning the performance by running the same query in DB, the same query without "distinct" can go so much faster than the original one from OBIEE.. So I'd like to configure my RPD so that certain reports will not have "select distinct". I know that by default, the BI server will always generate a "distinct", but is there a way to override this default, if not, what might be some performance tuning tactics I can use?
    Any thoughts?
    Thanks
    Edited by: user7276913 on Oct 27, 2009 8:20 PM

    BenS wrote:
    Two issues with this that I encountere:
    When I selected the first suggested option at the Physical Layer for the database, I found the "DISTINCT SUPPORTED" option. There were two columns checked: Value and Default. I was able to unselect Value but not Default.
    (1) What is the difference between Value and Default?
    (2) If I only unselect Value will it stop Answers from adding the DISTINCT to every query created?
    Second, when I selected the source from the business model mapping, it already did not have the DISTINCT box checked. Therefore, I could not limit this at the Logical layer as I would have preferred.
    If you could help me understand the first option it may clarify how to implement option # 2.
    Thanks...1) the defaults are stored in an .ini file and serve the purpose of defining the defaults when you hit the 'revert to default' button.
    If you unselect value, you are telling OBIEE that the database for which you are changing these options does not support the distinct clause, I doubt you wish to do this across the entire application.
    I think you will find that OBIEE applies the distinct :
    1) when the LTS has distinct ticked.
    2) When the column in question is not part of a dimension hierachy key (if it is, your telling the OBIEE server these should be unique, so wont issue the distinct)
    or
    3) the column forms part of a key in either logical BMM layer or as part of a physical key.
    adding the column to a Dim Hierachy wont be an option in most cases, you could try playing with just setting this column as a key on the BMM layer or Physical layer , and let us know if this helps.

  • SELECT DISTINCT OBJECT and ntext

    Hello,
    How can I write an ejb query that selects distinct ejbs, given that the underlying data table has NTEXT data in it?
    The old ejb query
    <ejb-ql><![CDATA[
    SELECT DISTINCT OBJECT(a) FROM Article AS a
    ]]></ejb-ql>
    used to work fine in weblogic 7, but it gives problems in wl8, where it transforms the ejbQl into a actual sql SELECT DISTINT FROM article
    command to the database (sql server) which in turn throws an sql exception about trying to select distinct when the table has an ntext column...
    Any help appreciated!

    One solution is the following:
    - use ejbSelect
    - and specify the exact columns you want distinct upon
    The reason the code was working in 7 was that distinct was done in (weblogic) code rather than pass on the database. Now in 8 distinct is passed on to the database (which is the correct behavior).
    Hello,
    How can I write an ejb query that selects distinct
    t ejbs, given that the underlying data table has
    NTEXT data in it?
    The old ejb query
    <ejb-ql>[CDATA[
    SELECT DISTINCT OBJECT(a) FROM Article AS a
    ]]</ejb-ql>
    used to work fine in weblogic 7, but it gives
    problems in wl8, where it transforms the ejbQl into a
    actual sql SELECT DISTINT FROM article
    command to the database (sql server) which in turn
    throws an sql exception about trying to select
    distinct when the table has an ntext column...
    Any help appreciated!

  • Specified Order Grouping does not show if Distinct Count is Zero

    Post Author: Hieu
    CA Forum: General
    Hello,
    I'm using Crystal Reports XI R2 with SQL data source. I have a cross-tab report with grouping in specified order. It's a report of applicants applying to a college. The grouping is of various majors (degrees). The report summarizes (distinct counts) the number of applicants for the groups of majors. The problem is that if the count for a group of major is zero, then that Named Group does not appear at all in the cross-tab report. I want the Name Group to appear with the count of "0".
    I notice this same phenomenon with specified order grouping anywhere and not just in a cross-tab. I have tried changing "convert database/other null values to default" but nothing working yet.
    Any help will be most appreciated. Thanks.

    Post Author: synapsevampire
    CA Forum: General
    It's not a phenomenon, it's how databases and SQL works.
    You didn't get any rows back for those with a zero distinct count (otherwise the count would be 1 or more, right?), so Crystal doesn't show any data for those groups.
    So to display a zero for those that do not exist would reuire either advanced SQL, or manual summaries.
    One method for manual summaries is to use Running Totals. Select distinct count of the applicants and group by the majors, then in the evaluate use a formula place:
    {table.majors} = "Blah 1"
    Creating a seperate Running Total for every group and replacing "Blah 1" with the various majors.
    -kai

Maybe you are looking for