Count the number of rows based on the values!!!

Hi all,
What I am using:
I am working with a multidimensional database in Visual Studio 2010 using its Data source view and calculation member and dimension usage.
What I want to do:
I have a fact table that has five columns(leg(s),hand(s), Head and body,overall) that shows the category of how severe the injury is. Let say for the records all columns never have an empty value(no injury is stated with 'No injury' ) . These five columns
are connected with a dimension that has all the available values (Category A-E of injury).The overall has the most severe from the other four columns. I want to create a bar chart with five different measure
values, one for each column, and count the values in those columns. 
For example : I have a slicer in the excel and a bar chart and the slicer has all the values of the Category of the injury ( Cat a,Cat B, Cat C, ... Cat E, No injury ) and when i select one of them, lets say
Cat C,  the bar chart should update and show how many Cat C each measurement column has. 
Example FACT table:
ID      LEG      HAND    HEAD   BODY OVERALL
1        No         A           No        No        A
2        No        D            C          C         C
3    E         C            D           A         A
4         E          E           B            C         B
So if i selected C the bar chart will count   (Leg = 0, Hand = 1, Head = 1, body = 2 and Overall = 1).
Any ideas ?
Thanks for the help and the time :) 

Hi DBtheoN,
According to your description, you want to create a chart on excel worksheet to count the rows based on the value, right? If in this case, I am afraid this issue is related to Office forum, I am not the expert of Office, you can post the issue on the corresponding
forum.
However, this requirement can be done easily on SQL Server Reporting Services. You can using the expression below to count the rows.
=COUNT(IIF(Fields!LEG.Value=Parameters!TYPE.Value,1,NOTHING))
Regards,
Charlie Liao
TechNet Community Support

Similar Messages

  • Count total number of rows present in the schema

    Count total number of rows present in the schema including table, sequence, view
    Desirable Output
    table          Sequence     Views
    1000          20          1000

    You mean You need to count the No of Tables, View and Sequence Present in the Schema ??
    Hi Some thing like this,
    SELECT a.view_cnt AS "View Count", b.tab_cnt AS "Table Count",
           c.seq_cnt AS "Sequence Count"
      FROM (SELECT COUNT (*) view_cnt
              FROM USER_VIEWS) a,
           (SELECT COUNT (*) tab_cnt
              FROM USER_TABLES) b,
           (SELECT COUNT (*) seq_cnt
              FROM USER_SEQUENCES) cWhich give you,
    View Count      Table Count      Sequence Count
           153              878                   32Thanks,
    Shankar
    Edited by: Shankar Viji on Aug 28, 2012 3:03 AM

  • How can i now the number of rows afected by the last query?

    how can i now the number of rows afected by the last query?
    For example:
    i made this update :
    update trl_trial set status = 1 /* Validation */
    where trial_id = cobject_id
    and status = 0; /* Initial */
    if NUMBERS_OF_ROWS = 0 then
    end if;
    how can i do this?
    thank u!!!!

    how can i now the number of rows afected by the last query?
    For example:
    i made this update :
    update trl_trial set status = 1 /* Validation */
    where trial_id = cobject_id
    and status = 0; /* Initial */
    if NUMBERS_OF_ROWS = 0 then
    end if;
    how can i do this?
    thank u!!!! Do the following :
    update trl_trial set status = 1 /* Validation */
    where trial_id = cobject_id
    and status = 0; /* Initial */
    if(SQL%ROWCOUNT = 0 ) then
    else
    end if;
    you can also declare a variable and do
    myvar := SQL%ROWCOUNT;
    SQL%ROWCOUNT returna the # of rows afected by any sql
    statement, like DELETE, UPDATE

  • How to get the number of rows written to the header of the spool file.

    Hi
    I need to create a header line for the spool file .
    the header line should include fixed length values .
    The header should include the number of records found in the table with a maximum begin date (begin_date is the column of the table)
    To get the header in the spool file , i wrote a select query has :-
    --SPOOL 'C:\Documents and Settings\abc\Desktop\output.TXT'
    select 'W'||to_char(sysdate,'MM/DD/YYYYMi:HH:SS')||lpad(max(rownum),9,'000000000') ||'R'||max(to_char(school_from_date,'MM/DD/YYYY')) ||
    rpad(' ',76,' ')
    from dad.school
    group by sysdate;
    SPOOL OFF
    which gets me all the rows in the table , but i only want the rows with the latest school_begin_date .
    how can i achieve that ...
    I know that a subquery should be written in the from clause to get the number of rows found with a maximum school_begin_date.
    select 'W'||to_char(sysdate,'MM/DD/YYYYMi:HH:SS')||lpad(max(rownum),9,'000000000') ||'R'||max(to_char(school_from_date,'MM/DD/YYYY')) ||
    rpad(' ',76,' ')
    from dad.school where
    select rownum from dad.school
    where school_begin_date = max(school_begin_date) ;
    the error i get is
    ORA-00934: group function is not allowed here
    I NEED HELP ..IN GETTING THE ROWNUM JUST FOR THE LATEST BEGIN_DATE ?
    PLS HELP ME IN WRITING THE QUERY .
    THANKS IN ADVANCE .

    Try this:
    select 'W'||to_char(sysdate,'MM/DD/YYYYMi:HH:SS')||lpad(max(rownum),9,'000000000')||'R'||max(to_char(school_from_date,'MM/DD/YYYY')) || rpad(' ',76,' ')
      from dad.school
    where school_begin_date = (select max(school_begin_date)
                                  from dad.school);

  • Sales Invoice - Fixing the number of rows isn't the solution. Ideas?

    Hi All,
    I have been working on converting the standard eBS Sales Invoice report to BIP over the past few weeks. I started to use the solution on Tim's blog:
    http://blogs.oracle.com/xmlpublisher/2007/03/27/
    For those people who haven't looked this, the solution uses variables to set and calculate the number of transaction rows to be displayed on a page. Filler rows are also inserted to pad out the page should the number of transaction rows be less that the number to be displayed on a page (if using this be careful though as there is a problem with the way the filler rows work as pointed out by Mike Parr in the comments of the blog http://blogs.oracle.com/xmlpublisher/2007/03/anatomy_of_a_template_ii_heade.html).
    This solution is fine if the size of the data in the transaction row is never long enough to cause it to wrap within a column. For example, in the Sales Invoice, it is common for the Invoice Line Description to wrap 3 or 4 lines within the column. When this happens, the rows per page method goes out of the window as the number that can physically fit on the page is reduced due to the single data row spanning multiple layout rows.
    I have had a good play around with fixing table row heights but to no avail. Also had a look at some of the standard RTF templates available in the latest release of R12. but couldn't find an example where this problem is addressed. I am 100% sure that someone must have hit this before so any advice and/or solutions would be greatly appreciated.
    Perhaps the solution for this could be incorporated into a future blog post or example?
    Cheers,
    Jon.

    Yep agreed. With fixed width fonts you could determine how many characters will display on a line but there is no telling where the word wrapping will occur. Suppose you could get really clever and use the position of the spaces to determine where the wraps will occur, then work out how many rows the line will take up (gulp!). Anyway, using fixed width fonts like courier will make the report look rubbish so I want to avoid this.
    A response from the Oracle bod's wouldn't go a miss on this? Tim, et al?
    Cheers,
    Jon.

  • Urgent******how can i get the number of rows enterd by the user in a table

    Hi Frndz..
    As per my requirement i need to do the validations for the multipple rows in a table that was enterd by the user,
                   T
              The prob is how can i get that number of rows that enterd by user,
           WDMessageManager msg = wdComponentAPI.getMessageManager();
         String col1= "";
         String col2= "";
         double col3= 0;
         double col4= 0;
         double amount= 0;
         int nodesize = wdContext.nodeTest().size();
         try
         for(int i=0; i<=2 ; i++)
                   col1 = wdContext.nodeTest().getTestElementAt(i).getCol1();
                 //msg.reportSuccess("col1 size is :"+col1);
                   col2 = wdContext.nodeTest().getTestElementAt(i).getCol2();
                   col3 = wdContext.nodeTest().getTestElementAt(i).getCol3();
                   col4 = wdContext.nodeTest().getTestElementAt(i).getCol4();
                    amount = wdContext.nodeTest().getTestElementAt(i).getAmount();
              if(col1 == "" )
                        msg.reportException("Plz fil the col1 for line:",true);
                   break;
              else
              if(col2 == "" )
                                  msg.reportException("Plz fil the col2 for line:",true);
                             break;
                        else
              if(col3 <= 0)
                   msg.reportException("Plz fil the col3:",true);
                   break;
              else
                   if(col4 <= 0)
                   msg.reportException("Plz fil the col4:",true);
                   break;
              msg.reportSuccess("skvgjhdfgasdfgsjkafguisafisenvtvyeriy");
                                                       wdThis.test();
         catch (Exception e)
                   msg.reportException("strMessage in catch block",true);
         this is the code am going
    Regards
    Rajesh

    Hi,
       You can try this:
    * Let's say the table's datasource is a node called Table  and it has two attributes first & second.
    * You want to check if any of these attributes has been changed by the user or not. If they have been
    * changed then you want to do some validations against them.
      int sizeOfTable = wdContext.nodeTable().size();
      for(int i = 0; i < sizeOfTable; i++){
         IPrivate<view name>.ITableElement ele = wdContext.nodeTable().getTableElementAt(i);
         if(ele.isChangedByClient(ITableElement.<attribute name>)){
            //value has been changed, do some validation. You can get the row index using ele.index().
    Regards,
    Satyajit.

  • Get the Number of rows or set the number of rows dynamically (internal tab)

    Hi,
    question pls see subject ?
    Regards
    sas

    Hi,
    Use the method describe_by_data of the class cl_abap_structdescr. this will give you a refernce of the class type descriptor class and you need to down cast it to a more specifc class of cl_abap_structdescr.
    Once you get the correct reference, you can use the components attribute and you will get a list of all the fields of that table.
    DATA: BEGIN OF line OCCURS 0,
            col1 TYPE i,
            col2(10) TYPE c,
            col3 TYPE i,
          END OF line.
    FIELD-SYMBOLS : <itab_line> TYPE ANY.
    DATA : BEGIN OF t_comp OCCURS 0,
            comp(5) TYPE c,
           END OF t_comp.
    DATA : l_struc TYPE REF TO cl_abap_structdescr.
    DATA : l_typedesc TYPE REF TO cl_abap_typedescr.
    DATA : lt_comp TYPE abap_compdescr_tab,
           w_comp LIKE LINE OF lt_comp.
    line-col1 = 11.line-col2 = 'SAP'.line-col3 = 33.
    APPEND line.
    line-col1 = 44.line-col2 = 'P.I.'.line-col3 = 66.
    APPEND line.
    ASSIGN line TO <itab_line>.  " Refer of the table is passed to the field symbol
    *Call the static method of the structure descriptor describe_by_data
    CALL METHOD cl_abap_structdescr=>describe_by_data
      EXPORTING
        p_data      = <itab_line>
      RECEIVING
        p_descr_ref = l_typedesc.
    *The method returns a reference of  a type descriptor class therefore
    *we need to Cast the type descriptor to a more specific class i.e
    *Structure Descriptor.
    l_struc ?= l_typedesc.
    *Use the Attribute COMPONENTS of the structure Descriptor class to get
    *the field names of the structure
    lt_comp = l_struc->components.
    data l_components.
    describe table lt_comp lines l_compoents.  " count the components
    Write : 'Table has ', l_component, ' fields.'.
    Hope this helps.
    regards,
    Advait

  • How to increase the number of row displayed in the result set.

    Hi All,
    I have a seeded oracle page OA.jsp?page=/oracle/apps/pa/structure/webui/FPStructVersionPG from projects module.
    On the above page, when we click on the financial tab to see the tasks, it shows only 180 tasks out of 298. I dont find any link on the page which would give me the rest of the tasks, overall it shows only 180 tasks.
    I checked the VO query it picks up all the 298 records.
      SELECT   *
        FROM   (SELECT   element_number,
                         element_name,
                         object_type,
                         element_version_id,
                         proj_element_id,
                         project_id,
                         display_sequence,
                       ---  milestone_flag,
                       ---  critical_flag,
                         parent_element_id,
                         relationship_type,
                         relationship_subtype,
                         summary_element_flag,
                      ----   progress_status_code,
                      ---   progress_status_meaning,
                      ---   progress_comments,
                     ---    scheduled_start_date,
                      --   scheduled_finish_date,
                         task_manager_id,
                         task_manager,
                         parent_structure_version_id,
                         wbs_level,
                         wbs_number,
                         DECODE (object_type,
                                 'PA_STRUCTURES', 'StructureVersion',
                                 'NoIcon')
                            AS structure_icon,
                       --  DECODE (critical_flag, 'Y', 'Critical', 'NoIcon')  AS critical_icon,
                     --    DECODE (milestone_flag, 'Y', 'Milestone', 'NoIcon') AS milestone_icon,
                         DECODE (relationship_type, 'L', 'Link', 'NoIcon')
                            AS link_icon,
                         DECODE (object_type, 'PA_STRUCTURES', 'Y', 'N')
                            AS disable_select_flag,
                         elem_rec_ver_number,
                         elem_ver_rec_ver_number,
                       --  elem_ver_sch_rec_ver_number,
                         DECODE (object_type,
                                 'PA_STRUCTURES', 'NoEditTaskNumber',
                                 'EditTaskNumber')
                            AS display_task_number,
                         DECODE (object_type,
                                 'PA_STRUCTURES', 'NoEditTaskName',
                                 'EditTaskName')
                            AS display_task_name,
                         DECODE (summary_element_flag,
                                 'Y', 'NoEditSchStartDate',
                                 'EditSchStartDate')
                            AS display_start_date,
                         DECODE (summary_element_flag,
                                 'Y', 'NoEditSchFinishDate',
                                 'EditSchFinishDate')
                            AS display_finish_date,
                         DECODE (object_type,
                                 'PA_STRUCTURES', 'NoEditTaskManager',
                                 'EditTaskManager')
                            AS display_task_manager,
                         DECODE (object_type, 'PA_STRUCTURES', '0', wbs_number)
                            AS outline_number,
                         element_number AS formatted_task_number,
                         element_name AS formatted_task_name,
                       --  progress_comments AS formatted_progress_comments,
                       --  scheduled_start_date AS formatted_start_date,
                      ---   scheduled_finish_date AS formatted_finish_date,
                         task_manager AS formatted_task_manager,
                      ---   status_icon_active_ind,
                       --  percent_complete_id,
                       ---  status_icon_ind,
                         NULL AS task_manager_raw,
                         DECODE (
                            task_manager,
                            NULL,
                            DECODE (summary_element_flag,
                                    'Y', '<B>' || task_manager || '</B>',
                                    task_manager)
                            AS task_manager_raw_no_link,
                         status_code,
                         status_code_meaning,
                         priority_code,
                         priority_description,
                         organization_id,
                         organization_name,
                      --   include_in_proj_prog_rpt,
                         description,
                         OBJECT_RELATIONSHIP_ID,
                         OBJECT_REC_VER_NUMBER,
                      --   pev_schedule_id,
                         parent_element_version_id,
                         STRUCTURE_TYPE_CLASS_CODE,
                         link_task_flag,
                         DISPLAY_PARENT_VERSION_ID,
                         parent_ver_rec_ver_number,
                        -- actual_start_date,
                        -- actual_finish_date,
                       --  estimated_start_date,
                      --   estimated_finish_date,
                      --   completed_percentage,
                      ---   as_of_date,
                       ---  report_version_id,
                         baseline_start_date,
                         baseline_finish_date,
                         DECODE (object_type,
                                 'PA_STRUCTURES', 'NoLinkedTaskName',
                                 'LinkedTaskName')
                            AS Linked_Task_name,
                         pm_source_name,
                         pm_source_code,
                         pm_source_reference,
                         DECODE (NVL (pm_source_name, 'Y'),
                                 'Y', NULL,
                                 pm_source_reference)
                            AS display_pm_source_ref,
                         element_name || ' (' || element_number || ')'
                            AS task_name_number,
                       --  est_sch_start_var,
                       ---  est_sch_finish_var,
                        -- act_sch_start_var,
                       --  act_sch_finish_var,
                       ---  sch_bsl_start_var,
                      ---   sch_bsl_finish_var,
                         DECODE (object_type,
                                 'PA_STRUCTURES', 'NoLinkTaskNameNumber',
                                 'LinkTaskNameNumber')
                            AS linked_task_name_number,
                      --   critical_flag_meaning,
                      --   milestone_flag_meaning,
                         work_telephone,
                         service_type_meaning,
                         service_type_code,
                         work_type_name,
                         work_type_id,
                         chargeable_meaning,
                         chargeable_flag,
                         billable_meaning,
                         billable_flag,
                         receive_project_invoice_m,
                         receive_project_invoice_flag,
                         transaction_ctrl_start_date,
                         transaction_ctrl_finish_date,
                       --  prior_percent_complete,
                      --   progress_brief_overview,
                      ---   SCHEDULE_AS_OF_DATE,
                    ----     TRANSACTION_AS_OF_DATE,
                   ---      BASELINE_AS_OF_DATE,
                     ---    ESTIMATE_AS_OF_DATE,
                      --   ACTUAL_AS_OF_DATE,
                         ACTIVE_TASK_MEANING,
                         DAYS_TO_SCH_START,
                         DAYS_TO_SCH_FINISH,
                         FINANCIAL_TASK_FLAG,
                       ---  DAYS_TO_ESTIMATE_START,
                       --  DAYS_TO_ESTIMATE_FINISH,
                       --  DAYS_SINCE_ACT_START,
                        -- DAYS_SINCE_ACT_FINISH,
                        -- FINISHED_TASK_FLAG,
                        -- FINISHED_TASK_MEANING,
                         TASK_CREATION_DATE,
                         LOWEST_TASK_MEANING,
                         TASK_TYPE_ID,
                         TASK_TYPE,
                         TASK_STATUS_CODE,
                         TASK_STATUS_MEANING,
                       --  PHASE_CODE,
                        -- PHASE_CODE_MEANING,
                        -- PLANNED_EFFORT,
                       --  WEIGHTING_PERCENTAGE,
                        -- SCHEDULED_DURATION_DAYS,
                        -- BASELINE_DURATION_DAYS,
                        -- ESTIMATED_DURATION_DAYS,
                        -- ACTUAL_DURATION_DAYS,
                         ADDRESS_ID,
                         ADDRESS1,
                         ADDRESS2,
                         ADDRESS3,
                         ADDRESS4,
                       --  WQ_ITEM_CODE,
                       --  WQ_ITEM_MEANING,
                        -- WQ_UOM_CODE,
                        -- WQ_UOM_MEANING,
                        -- WQ_PLANNED_QUANTITY,
                        -- ACTUAL_WQ_ENTRY_CODE,
                        -- ACTUAL_WQ_ENTRY_MEANING,
                        -- PROG_ENTRY_ENABLE_FLAG,
                        -- PERCENT_COMP_ENABLE_FLAG,
                        -- REMAIN_EFFORT_ENABLE_FLAG,
                        -- TASK_PROGRESS_ENTRY_PAGE_ID,
                        -- PAGE_NAME,
                        -- BASE_PERCENT_COMP_DERIV_CODE,
                        -- BASE_PERCENT_COMP_DERIV_M,
                        -- WQ_ENABLE_FLAG,
                         --PROG_ENTRY_REQ_FLAG,
                            address1
                         || ''
                         || address2
                         || ''
                         || address3
                         || ''
                         || DECODE (address4, ' , , ', '', address4)
                            work_site_full_address,
                         STRUCT_PUBLISHED_FLAG,
                         --ACTUAL_WORK_QUANTITY,
                        -- ESTIMATED_REMAINING_EFFORT,
                        -- VERSIONING_ENABLED_FLAG,
                         ---PHASE_VERSION_ID,
                         project_name,
                         project_number,
                         TASK_UNPUB_VER_STATUS_CODE,
                         DECODE (summary_element_flag, 'Y', 1, 0) AS leaf_task_flag,
                         0 AS PROJ_LEVEL_DISABLE_FLAG,
                         child_element_flag,
                         OPEN_ISSUES,
                         OPEN_CHANGE_DOCUMENTS,
                        -- phase_name,
                        -- days_until_scheduled_finish,
                         DECODE (TASK_UNPUB_VER_STATUS_CODE, 'TO_BE_DELETED', 1, 0)
                            AS to_be_deleted_image,
                         'WorkInfo' AS task_manager_called_page,
                         '-1' AS task_manager_resource_id,
                         OPEN_CHANGE_REQUESTS,
                         OPEN_CHANGE_ORDERS,
                         0 AS structure_type_flag,
                         DECODE (
                            PA_PROJ_ELEMENTS_UTILS.IS_LOWEST_LEVEL_FIN_TASK (
                               project_id,
                               element_version_id,
                               'N'
                            'N',
                            'Y',
                            'N'
                            AS FinChildElementFlag,
                         DECODE (
                            PA_PROJ_ELEMENTS_UTILS.CHECK_IS_FINANCIAL_TASK (
                               proj_element_id
                            'N',
                            1,
                            0
                            txn_dates_flag
                  FROM   pa_fin_structures_tasks_v) QRSLT
    ORDER BY   display_sequencePlease suggest how to get this done, this is oracle seeded module.
    Ashish

    Hi Ashish,
    Please check with vo.getRowCount();how many results are being fetched by vo.else substitute the vo to get vo,setMaxfetchSize().I'm not sure.Please check with this.I will be very glad if you let me know.
    Best Regards
    Krishna Priya Bandyopadhyay

  • Count the number of rows in an array

    Hi there,
    I'm quite new with Labview, maybe somebody can help me.
    I have a .vi that controls two pump with certain ratios (to make a composition gradient). I export the data to an ascii file, which write the displacement of the two pumps in 2 colums. However, the number of rows is related to the ms-counter, and thus related to the processor of the computer. Now I need, at the end of the vi, to get the number of rows written to the ascii file, to do some further calculations. Does anybody know how to do this?!
    Thanks

    You could wire the loop-counter to a variable outside the loop, so you can see the number of iterations (don't forget to add 1).
    You also can use the Array Size-Function. Here you get different outputs, according to the dimensions of the array to get the size of.
    Here you can see what you get if you use this function:
    1D-Array: one value
    2D-Array: array, item 0 = number of rows, item 1 = number of columns
    3D-Array: array, item 0 = number of pages, item 1 = number of rows, item 2 = number of columns
    So if (in your case) you wire a 2D-Array you can use the array-size function, select item 0 of the array you get and you get the number of rows.
    You can also have a look at the attachement.
    Hope it helps.
    Thomas
    Using LV8.0
    Don't be afraid to rate a good answer...
    Attachments:
    ArraySize.vi ‏17 KB

  • Count the number of rows resulting from a select statement

    Hi,
    Is there any way of counting the number of rows resulting from a select statement. i.e I have a select distinct statement and I then want to perform an IF statement on the number of rows resulting from the select statement.
    Any help appreciated
    Thanks
    Gary

    Declare
    var1 number;
    Begin
    select count(distinct column_name) into
    var1 from table_name;
    If var1 > x Then
    End IF;
    End;
    Hope I understood the problem correctly
    null

  • How to get the total number of occurrences based on the value of a column.

    Hello everyone,
    This is the first time that I will ask question here on your forum but has been following several threads ever since. I guess that now is my turn to ask a question. So anyway here is the thing, I have a query that should return count the number of rows depending on the value of SLOT. Something like this:
    WIPDATAVALUE          SLOT             N            M
    1-2                   TRALTEST43S1     1            3
    1-2                   TRALTEST43S1     2            3
    3                     TRALTEST43S1     3            3
    4-6                   TRALTEST43S2     1            4
    4-6                   TRALTEST43S2     2            4
    4-6                   TRALTEST43S2     3            4
    7                     TRALTEST43S2     4            4-----
    As you can see above, on the SLOT TRALTEST43S1, there are three occurrences so M (Total number of occurrences) should be three and that column N should count it. Same goes with the SLOT TRALTEST43S2. This is the query that I have so far:
    SELECT DISTINCT
    WIPDATAVALUE, SLOT
    , LEVEL AS n
    , m
    FROM
      SELECT
        WIPDATAVALUE
        , SLOT
        , (dulo - una) + 1 AS m
      FROM
        SELECT
          WIPDATAVALUE
          , SLOT
          , CASE WHEN INSTR(wipdatavalue, '-') = 0 THEN wipdatavalue ELSE SUBSTR(wipdatavalue, 1, INSTR(wipdatavalue, '-')-1) END AS una
          , CASE WHEN INSTR(wipdatavalue, '-') = 0 THEN wipdatavalue ELSE SUBSTR(wipdatavalue, INSTR(wipdatavalue, '-') + 1) END AS dulo
        FROM trprinting
        WHERE (containername = :lotID OR SLOT= :lotID) AND WIPDATAVALUE LIKE :wip
    ) CONNECT BY LEVEL <= m
    ORDER BY wipdatavalue;And that it results to something like this:
    WIPDATAVALUE          SLOT             N            M
    1-2                   TRALTEST43S1     1            2
    1-2                   TRALTEST43S1     2            2
    3                     TRALTEST43S1     1            1
    4-6                   TRALTEST43S2     1            3
    4-6                   TRALTEST43S2     2            3
    4-6                   TRALTEST43S2     3            3
    7                     TRALTEST43S2     1            1-----
    I think that my current query is basing its M and N results on WIPDATAVALUE and not the SLOT that is why I get the wrong output. I have also tried to use the WITH Statement and it works well but unfortunately, our system cant accept subquery factoring.
    I know you guys will be helping out because you are all awesome. Thanks everyone
    Edited by: 1001275 on Apr 19, 2013 8:07 PM
    Edited by: 1001275 on Apr 19, 2013 8:18 PM

    Hi,
    Sorry, it's still not clear what you want.
    Are you saying that, given this table:
    CREATE TABLE trprinting
      WIPDATAVALUE       VARCHAR2(255)
    , SLOT               VARCHAR2(255)
    INSERT INTO trprinting (wipdatavalue, slot) VALUES ('1-2',  'TRALTEST43S1');
    INSERT INTO trprinting (wipdatavalue, slot) VALUES ('3',    'TRALTEST43S1');
    INSERT INTO trprinting (wipdatavalue, slot) VALUES ('4-6',  'TRALTEST43S2');
    INSERT INTO trprinting (wipdatavalue, slot) VALUES ('7',    'TRALTEST43S2');you want to produce this output:
    WIPDATAVALUE SLOT                     N          M
    1-2          TRALTEST43S1             1          3
    1-2          TRALTEST43S1             2          3
    3            TRALTEST43S1             3          3
    4-6          TRALTEST43S2             1          4
    4-6          TRALTEST43S2             2          4
    4-6          TRALTEST43S2             3          4
    7            TRALTEST43S2             4          4? If so, here's one way:
    WITH     got_numbers     AS
         SELECT     wipdatavalue
         ,     slot
         ,     TO_NUMBER ( SUBSTR ( wipdatavalue
                               , 1
                           , INSTR ( wipdatavalue || '-'
                                ) - 1
                     )          AS low_number
         ,     TO_NUMBER ( SUBSTR ( wipdatavalue
                               , 1 + INSTR ( wipdatavalue
                     )          AS high_number
         FROM     trprinting
    SELECT       wipdatavalue
    ,       slot
    ,       ROW_NUMBER () OVER ( PARTITION BY  slot
                                 ORDER BY          low_number
                        )                    AS n
    ,       COUNT (*)     OVER ( PARTITION BY  slot )     AS m
    FROM       got_numbers
    CONNECT BY     LEVEL               <= high_number + 1 - low_number
         AND     low_number          = PRIOR low_number
         AND     PRIOR SYS_GUID ()      IS NOT NULL
    ORDER BY  low_number
    ,            n
    ;Much of the complexity here is caused by storing 2 numbers in 1 VARCHAR2 column, wipdatavalue. Relational databases work best when there is no more than 1 item in any given column of any given row. This is so basic to datbase design that it is called First Normal Form. Also, numbers belong in NUMBER columns, not VARCHAR2. If you stored your data like that in the fist place, then you wouldn't need the sub-query I called got_numbers, which is about 60% of the code above. (That could be reduced by replacing SUSTR and INSTR with the less efficient REGEGP_SUBSTR.)

  • How to get the number of rows in a report region

    Hi all,
    Is there a way to get the number of rows returned in a report region, without issuing an additional "select count(*) from some_table"?
    I mean something like the substitution string #ROW_NUM# but for the total rows.
    Thanks,
    Pedro.

    http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/ui.htm#CHDDGGEG
    For classic report regions, the region footer supports the following substitution strings:#ROWS_FETCHED# shows the number of rows fetched by the Oracle Application Express reporting engine (the page size). You can use these substitution strings to display customized messages to the user. For example:
    Fetched #ROWS_FETCHED# rows in #TIMING# seconds.
    *#TOTAL_ROWS# displays the total number of rows that satisfy a SQL query used for a report.*
    #FIRST_ROW_FETCHED# and #LAST_ROW_FETCHED# display the range of rows displayed. For example:
    Row(s) #FIRST_ROW_FETCHED# through #LAST_ROW_FETCHED# of #ROWS_FETCHED# displayed>
    Ta,
    Trent

  • Get the number of rows returned by a dataProvider

    hi
    I am using a [Bindable] variable that I am setting and using
    as a DataProvider (coming from a web service) for a DataGrid within
    my Flex 2 application.
    is there a way of knowing the amount of rows that the
    dataProvider is returning???
    as I want to do a calculation to set the height of the
    dataGrid depending on the amount of rows being returned by the
    dataGrid!
    any suggestions...?
    Thanks,
    Jon.

    that only seems to count the default number of rows (height)
    of the datagrid..... i.e. 7.
    I need to know the number of rows being returned from the
    dataProvider - i.e. the number of rows coming through the
    webService from the database etc.....
    Thanks,
    Jon.

  • How to set the number of rows displayed in a classical report at runtime?

    Hi,
    Our customer has several standard client hardware configuration and would like to enable end users to choose their 'display profile' at login time. This 'display profile' would contain predefined values for these hardware configurations and supposed to set various paramters that should define the number of rows displayed in a classical report region.
    I tried to provide parameters on the report region but it refused to accept anything but numerical values. Is it possible to do this?
    Regards, Tamas

    The link is to the closest linkable point in the documentation to the description of the Number of Rows (Item) attribute.
    It sounds like you have been trying to enter&mdash;unsuccessfully&mdash;an item name or substitution string into the Number of Rows attribute. The Number of Rows (Item) attribute is the one that actually allows you to do this. Click on the flashlight icon beside it to get a list of items from the application.

  • How do I limit the number of rows retrieved at a time using RefCursor?

    I have a PL/SQL package in use, that returns a REF CURSOR. This is currently being used in a Forms 6i application. Now I want to develop an ASP.NET web application that displays exactly the same information as my Forms 6i module. In fact those two applications will be used concurrently for a while.
    I looked at the sample code provided on otn.oracle.com and decided to use the OracleDataAdapter.Fill()-method to fill a dataset and bind that dataset to a pageable GridView. Now I wonder, whether this method retrieves ALL records of the query at once and how I can limit the number of rows fetched? The Select statement retrieves up to 10000 rows at a time. Most of the time, a user is only interested in the first 20-30 rows. Forms 6i fetches more rows as the user scrolls down, how can I implement the same behavior in ODP.NET?
    - Markus

    Excuse me, but the reply does not quite answer my question. Maybe I did not explain my concerns clear enough:
    I understand the use of the two properties (RowSize and FetchSize) to reduce the amount of round trips needed to transfer the data - not the number of rows fetched in total. This would still lead to a situation where all rows are transferred, when I am using the OracleDataAdapter.Fill()-Method. Is this correct or did I misunderstand the function of this method?
    I quote the otherwise really helpful article you send me:
    Of course, there is a cost if the fetch size is arbitrarily large. More client-side memory and processor cycles will be needed to store and manage a larger amount of data. The goal is to find a high-performing balance between the number of round trips and the amount of data retrieved per trip.
    My RowSize is for sure a bit larger than the one in the given example. The query will probably be used by up to 100 users at a time, so I would like to limit the resource-costs not only on the network by the number of round trips, but also on the web-server which is storing all these records in it's memory per user-request.

Maybe you are looking for

  • Unable to transfer windows 7 files due to DLL error message

    I recently went from PC to Macbook Pro and have been unable to transfer files from my windows 7 due to an error message "missing DLL File" Does anyone have a sloution to this problem or a sucessfull alternitive transfer method?

  • Using Stories and Menus

    When I first heard about stories I was very excited. I thought of how many times I had made a menu that had three buttons and depending on which one you pick it has to go to another menu but return to a totally different menu. I have had to make mult

  • Business Process Flow and Structures of R/3 for BW

    Dear Gurus, Given that BW person need not have detail understanding of R/3 modules, like to know is there a book, from SAP or others, to bridge this gap? That is, one that enables BW person to have sufficient functional knowhow of all or some of the

  • Ghost or Raid Drive ???

    i want to set up a couple of drives to operate as one, mainly for backup and safety purposes. how can i do this? i know on the pc side of things there is an application called ghost. is there a similar thing on the mac side? az

  • Question about Hibernate non-automatic id generator

    Hello I have a small problem which I cannot fix. I insert an object into the database which has a fixed ID that is entered on the website. Hibernate adds this perfectly, all goes well. But when i try to edit (through session.update()) it will not cha