Filtering records in BMM

I have a customer that wants to filter records in the BMM... It should work as a view in DB or a table type select in physical layer... like select * where Type=6.
Trouble is that he cannot or wouldn't change the physical layer.
The only way I can see to do this in BMM is when mapping the logical column to the physical column, in the expression do a CaseIf Type=6 then map... I'd have to do this for every column... am I correct ?
Pls. is there another way to do it ... easier ?
Txs. for any help.
Antonio

Use Where clause in Content tab of logical table source properties.
No need of any more changes.
Pls mark correct/helpful if helps

Similar Messages

  • User selection to return filtered record set

    Hi,
    I want to create a JSP which allows a user to enter search criteria for several columns of a table. I will use the entered values to set the sql where clause and produce the filtered record set. (eg the user enters a particular customer code and status code in order to see a list of orders placed by that customer which have the selected status code.)
    The problem I have is this: I want the input fields for the selection criteria to be combo boxes populated with values from the database.
    What is the best way to do this?

    Hi,
    I want to create a JSP which allows a user to enter search criteria for several columns of a table. I will use the entered values to set the sql where clause and produce the filtered record set. (eg the user enters a particular customer code and status code in order to see a list of orders placed by that customer which have the selected status code.)
    The problem I have is this: I want the input fields for the selection criteria to be combo boxes populated with values from the database.
    What is the best way to do this?

  • Urgent: how to get filtered records in ALV

    Hi
    I have used ALV in OO context. However when i apply the filter and get the filtered entries on the screen, I want to get these filtered records into an internal table.  How do I do this.  I have tried using the methods GET_FILTERED_ENTRIES and GET_FILTER_CRITERIA, but it does not work.  Please help me in getting the filtered records into an internal table.
    Thanks
    Vijay

    You can use REUSE_ALV_GRID_LAYOUT_INFO_GET to get the information about the layout, including the filter criteria, then use that to figure out which records to process.

  • To know filtered records

    Hi
    I have used ALV with FM REUSE_ALV_HIERSEQ_LIST_DISPLAY. However when i apply the filter and get the filtered entries on the screen, I want to get these filtered records into an internal table. How do I do this.?
    Thanks
    José

    Hi François.
    Thanks for your question.
    I have used this FM but not working.
    *  -->  p1        text
    *  <--  p2        text
    FORM USER_COMMAND  USING r_ucomm     LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
          CALL FUNCTION 'REUSE_ALV_TRANSFER_DATA_BACK'
           EXPORTING
             IT_FIELDCAT               = gt_fieldcat[]
    *         IS_LAYOUT                 =
    *         IT_SORT                   =
    *         IT_FILTER                 =
    *         IT_EXCLUDING              =
    *         IT_SPECIAL_GROUPS         =
    *         IS_KEYINFO                = 
    *         IS_LIST_SCROLL            =
    *         IS_LINEINFO               =
    *         IT_FILTERED_ENTRIES       =
           IMPORTING
    *         ET_FIELDCAT               =
    *         ES_LAYOUT                 =
    *         ET_SORT                   =
    *         ET_FILTER                 =
    *         ET_EXCLUDING              =
    *         ET_SPECIAL_GROUPS         =
    *         ES_KEYINFO                =
    *         ES_LIST_SCROLL            =
    *         ES_PRINT                  =
    *         ES_LINEINFO               =
              ET_FILTERED_ENTRIES       = ET_FILTERED_ENTRIES.
    ENDFORM.
    How do I do this.?
    You have any example?
    this is the code for to make the alv
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
    * I_INTERFACE_CHECK = ' '
          i_callback_program             = g_repid
    I_CALLBACK_PF_STATUS_SET = 'STATUS'
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
        is_layout                      = gs_layout
        it_fieldcat                    = gt_fieldcat[]
    * IT_EXCLUDING =
    * IT_SPECIAL_GROUPS =
    IT_SORT = it_sort
    IT_FILTER = it_filter[]
    * IS_SEL_HIDE =
    * I_DEFAULT = 'X'
    I_SAVE = 'A'
    * IS_VARIANT =
    IT_EVENTS = d_eventcat
    * IT_EVENT_EXIT =
          i_tabname_header               = 'GT_HEADER'
          i_tabname_item                 = 'GT_ITEM'
    * I_STRUCTURE_NAME_HEADER =
    * I_STRUCTURE_NAME_ITEM =
          is_keyinfo                     = gs_key
    * IS_PRINT =
    * IS_REPREP_ID =
    * I_BUFFER_ACTIVE =
    * I_BYPASSING_BUFFER =
    * IMPORTING
    * E_EXIT_CAUSED_BY_CALLER =
    * ES_EXIT_CAUSED_BY_USER =
        TABLES
          t_outtab_header                = gt_header[]
          t_outtab_item                  = gt_item[]
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.

  • How to create count() measure for certain set of records in BMM Layer

    Hello all.
    I have a logical table like this one (Table AAA)
    Table AAA
    <p>
    --------------------------+<p>
    |       *Key*            |    *Name* |   <p>
    --------------------------+<p>
    |    1-2EMHS9     | AAA      |<p>
    --------------------------+<p>
    | 1-2EMWMO      | BBB      |<p>
    --------------------------+<p>
    |         NULL       |     CCC   |<p>
    --------------------------+<p>
    I need to calculate count() of records where <b>Key is not NULL</b>. In this example, this field must return coun() = 2.
    I suppose, CASE operator may help me with that, but I do not know for sure how to do this.
    Thank you for help,
    Alex.

    Thank you.
    But I must concretise my issue.
    I need to calculate number of records (e.g. order_id) that sutisfy appropriate condition (one of columns (e.g. loy_member_id) is set to null).
    I created logical column, that returns order_id if condition (loy_member_id is null) is met.
    Look at my logical column:
    Q Orders (LPM) - must return number of orders where loyalty_member_id is null.
    It has an expression:
    CASE  WHEN  NOT "Foxtrot (my) replica"."Sales Orders".LOY_MEMBER_ID IS NULL  THEN "Foxtrot (my) replica"."Sales Orders".ORDER_ID ELSE  NULL  END
    So, this returns order_id I need.
    But the question is how to count number of <b>order_id</b>'s returned by this column on BMM Layer.
    When I define my column with next expression:
    *<u>COUNT</u>(CASE WHEN NOT "Foxtrot (my) replica"."Sales Orders".LOY_MEMBER_ID IS NULL THEN "Foxtrot (my) replica"."Sales Orders".ORDER_ID ELSE NULL END)*
    I receive error:
    +[38083] The Attribute 'Q Orders LPM' defines a measure using an obsolete method.+
    Thank you,
    Alex.
    Edited by: Alex B on 3/3/2009 19:59

  • GroupFilter and sum(); filtered records should not be included in the sum()

    Hi All,
    I am working on a report that has the following requirement.
    1. Query records from the database (multiple queries)
    2. Filter records based on a certain criteria.
    3. Sum() the rows.
    4. Cannot use where clause because of the complexity of the report.
    I have achieved the above requirement using data-template with one exception where my sum() is including all the filtered rows in the summation. I DO NOT want the filtered rows to be included in the sum(). I know I could do sum() in layout-template using xslt.
    Is there a way to do this in data-template?
    My data-template looks something like
    <group name="g_dept" source="q_dept">
        <element name="dname" value="dname"/>
        <element name="d_salary" value="g_emp.salary" function="sum()"/>
        <group name="g_emp" source="q_emp" groupFilter="filterEmployees(:empno)">
           <element name="ename" value="ename"/>
           <element name="empno" value="empno"/>
           <element name="salary" value="salary"/>
        </group>
    </group>
    My data looks like
    10    Scott1    7865    $100
    10    Scott2    6875    $200
    10    Scott3    5678    $300
    10    Scott4    8657    $500 <-- filtered with pl/sql package
    My output should look like
    Dept: 10
    Scott1    7865    $100
    Scott2    6875    $200
    Scott3    5678    $300
    Total for 10: $600
    instead my output looks like
    Total for 10: $1100 <-- including filtered row Steve.
    Is this a feature or a bug in the data-template? not sure the order of events querying, filtering & summation. If anyone could answer, I really appreciate it.
    Thanks

    Was there ever an answer the original question with the groupfilter and sum()?
    I have a GL Report (bi pub 5.6.3 with ebusiness suite 11.5.10.2) that uses the oracle.apps.fnd.flex.kff.select (with security as the output type). In my lowest group (lines) i have a group filter that eliminates the row if the security is Y (to eliminate it from the XML and report). However, the sums that I'm doing are including all rows, not just the ones included in the data file.
    I too have the same issue as Kalagara, where I can't use the where clause to exclude the rows.
    Thanks - Jennifer

  • Filtering records using a start routine inside the update rules for a dmart

    Hi
    I am using a start routine inside the update rules. I want to filter out all records that have 0 in all three fields. My problem is that it not only filters these records, but also filter records with negative values, which I do not want. Only 1 field has a negative value, the other 2 have 0.
    I have tried:
    DELETE DATA_PACKAGE where  /BIC/ZBILLCONS = 0 and /BIC/ZBREVPRIM = 0  and /BIC/ZBREVSUBO = 0 .
      DELETE DATA_PACKAGE where ( /BIC/ZBILLCONS = 0 and /BIC/ZBREVPRIM = 0  and /BIC/ZBREVSUBO = 0 ).
    also tried:
    delete DATA_PACKAGE where /BIC/ZBILLCONS IS INITIAL and
    /BIC/ZBREVPRIM IS INITIAL and  /BIC/ZBREVSUBO IS INITIAL.
    The records are going to 1 cube and 1 ODS, I only have the start routine in 1 update rule. I  view the filtering in the PSA.
    Has anyone ran into this before?

    Try
    delete data_package where /BIC/ZBILLCONS = '0' and /BIC/ZBREVPRIM = '0' and /BIC/ZBREVSUBO = '0' .
    OR
    delete data_package where /BIC/ZBILLCONS EQ '0' and /BIC/ZBREVPRIM EQ '0' and /BIC/ZBREVSUBO EQ '0' .
    Good luck!

  • Current Record not in Filtered Records

    OK... has anyone written any logic to circumvent this issue.
    I had a filter I applied and the page I was on was outside the
    current filter. What happened is the filter changed the records in
    the set... but it ended up displaying an empty set of rows
    (paging). Had to page back to the rows. I would think we need a
    standard function so if the filter returns less rows than the
    current offset that it would automatically jump back to the first
    set of rows.

    Hi John
    Don't know whether what I learned applies to you situation on
    not; but, I had trouble getting the right detail records after
    doing filtering. (I had to filter out some records in the original
    XML based on a status attribute.). Found the problem in that the
    number of records and the actual records were now different. I had
    to experiment with the ID and the RecordNumber to get the right
    stuff. The code snippit shows this:
    <div id="collsList" spry:region="dsColls">
    <div spry:repeat="dsColls" id="c_{ds_RowNumber}"
    spry:hover="rowHov" onclick="handleCollClick('{ds_RowID}');"
    onmouseover="mOver('{ds_RowNumber}');" onmouseout="mOut();"
    title="click to see listing of available documents in {collName}"
    class="liveColl">{collName}</div>
    </div>
    Usually, I've used ds_RowID as the key value. Althought this
    was needed in some situations with my filtered set, in others I
    needed to use ds_RowNumber. That got me the right stuff for the
    situaion.
    As I said, don't know whether this is similar situation as
    yours, but if so, this might help.
    Good luck
    Keith

  • Filtering records in a block

    Hi all,
    I am working on form developed by some other party.
    In this form one is control block which contains a combo box.
    There is another data block which is based on a table.
    When I run the form the records in this block are filtered by the value chosen in combo box.
    But I am not able to find the code where this functionality is achieved.
    I have checked WHERE clause property of block and the property is null.
    Also default_where is not set at runtime.
    Is there any other way to filter records in a block?
    Thanks in advance.
    MK

    Hi there,
    If there a Push Button on the Control Block to initiate the Execute query for the data block, then the code is in the When-Button-pressed trigger.
    If there is no Push Button and if the data block (based on table) changes after a new value is chosen from the combo box, then the default_where or onetime_where code may be hiding behind a When-Validate-item trigger (or some other trigger) in the combo box.
    In our application, we have many 'search' fields in the control block. We use a Push Button to build the dynamic where clause for the data block.
    Regards,
    John

  • Filtering records with deletion flag in Query report

    Dear Friends,
    We are using ECC6.00 (EHP4) for one of our QM requirement, i have created a query in SQ01 with the tables QMEL,AUFK,AFKO,QMFE etc., to get the details of production order and notification.
    The report will list out the production scheduler wise, order wise, defect wise quantity with the notification number also in the display.
    For notifications which are created wrongly, the users set deletion flag. The same i.e., notifications with deletion flag should not appear in the report and hence i have called the field and filtered the value in the output (i.e., field value not equal to X where X is for deletion flag set records).
    Everything works fine upto this, but when users (to carry out analysis) send the data to the spread sheet, the filter values are removed and all records are populated in the excel sheet (even records with deletion flag).
    To select and display only records without deletion flag, i want to introduce coding in the query. Kindly tell me whether this is possible, if so where and what code should be written to meet my requirement.
    The records with the deletion flag (notifications) should be eliminated from the selection and display.
    Experts help required.
    Regards,
    M.M

    Dear Raymond Giuseppi,
    Thank you for your reply. The code syntax had been corrected based on your information. Unfortunately the code doesn't filter the records. On further investigation , it was observed that the field KZLOESCH doesn't get updated and hence a field had been created in the infoset wherein the following  coding is written
    clear : w_dlfl.
    data : w_inact type char1.
    select single inact into w_inact from jest
    where objnr = qmel-objnr
       and stat = 'I0076'
       and inact ne 'X'.
    if sy-subrc = 0 .
      w_dlfl = 'X'.
    else.
      w_dlfl = ''.
    endif.
    The field name is W_dlfl.
    In the above condition how and where should i include the code given by you. Since the field KZLOESCH is not updated how should we get the data from the field w_dlfl be exempted from selection?
    Kindly provide solution.
    Regards,
    M.M

  • Query error - with filtering records

    Hi. I have a gallery that shows 9 records at a time, which
    you can then move on to subsequent pages. I added filters to narrow
    down the record search, however, I am receiving query errors. This
    is my code:
    <!----- This is setting the initial defaults for the filter
    variables ---->
    <cfparam name="form.ART_CATEGORY_ID" default="">
    <cfparam name="form.ART_TYPE_ID" default="">
    <cfparam name="form.FINE_ART_CLASS_ID" default="">
    <cfparam name="form.searchfield" default="">
    <!----- Populate the CATEGORIES filter drop-down ---->
    <cfquery name="categories" datasource="nancy">
    SELECT *
    FROM CATEGORIES
    ORDER BY ART_CATEGORY_ID
    </cfquery>
    <!----- Populate the TYPES filter drop-down ---->
    <cfquery name="types" datasource="nancy">
    SELECT *
    FROM TYPE
    ORDER BY ART_TYPE_ID
    </cfquery>
    <!----- Populate the CLASS filter drop-down ---->
    <cfquery name="class" datasource="nancy">
    SELECT *
    FROM CLASS
    ORDER BY FINE_ART_CLASS_ID
    </cfquery>
    <!----- Create the filter drop-down selections ---->
    <form method="post" action="root_fineart.cfm">
    <select name="ART_TYPE_ID">
    <option value="" <cfif trim(form.ART_TYPE_ID) eq
    "">selected
    </cfif>> All </option>
    <cfoutput query="types">
    <option value="#ART_TYPE_ID#"
    <cfif form.ART_TYPE_ID eq
    types.ART_TYPE_ID>selected</cfif>>#ART_TYPE#</option>
    </cfoutput>
    </select>
    <select name="ART_CATEGORY_ID">
    <option value="" <cfif trim(form.ART_CATEGORY_ID) eq
    "">selected
    </cfif>> All </option>
    <cfoutput query="categories">
    <option value="#ART_CATEGORY_ID#"
    <cfif form.ART_CATEGORY_ID eq
    categories.ART_CATEGORY_ID>selected</cfif>>#ART_CATEGORY#</option>
    </cfoutput>
    </select>
    <select name="FINE_ART_CLASS_ID">
    <option value="" <cfif trim(form.FINE_ART_CLASS_ID) eq
    "">selected
    </cfif>> All </option>
    <cfoutput query="class">
    <option value="#FINE_ART_CLASS_ID#"
    <cfif form.FINE_ART_CLASS_ID eq
    class.FINE_ART_CLASS_ID>selected</cfif>>#FINE_ART_CLASS#</option>
    </cfoutput>
    </select>
    <!----- This also creates a SEARCH capability ---->
    <input name="searchfield" type="text" size="10"
    value="#form.searchfield#" /></cfoutput> </label>
    <input name="submit" type="submit" value="Submit" />
    <!----- I got this part of the code from a site, that allows
    me to display the 9 records at a time in my gallery ---->
    <cfparam name="start" type="numeric" default="1">
    <cfparam name="step" type="numeric" default="9">
    <!----- My query to retrieve the records... This may be where
    I have something wrong... ---->
    <cfquery datasource="nancy" cachedwithin=".01"
    name="queryResults">
    SELECT *
    FROM ART
    WHERE 1 = 1
    <cfif val(form.ART_CATEGORY_ID) GT 0>
    AND ART_CATEGORY_ID = <cfqueryparam
    value="#form.ART_CATEGORY_ID#" cfsqltype="cf_sql_integer">
    </cfif>
    <cfif val(form.ART_TYPE_ID) GT 0>
    AND r.ART_TYPE_ID = <cfqueryparam
    value="#form.ART_TYPE_ID#" cfsqltype="cf_sql_integer">
    </cfif>
    <cfif val(form.FINE_ART_CLASS_ID) GT 0>
    AND i.FINE_ART_CLASS_ID = <cfqueryparam
    value="#form.FINE_ART_CLASS_ID#" cfsqltype="cf_sql_integer">
    </cfif>
    <cfif trim(form.searchfield) neq "">
    AND ART_TITLE LIKE '%#form.searchfield#%'
    </cfif>
    ORDER BY ART_TITLE ASC
    </cfquery>
    <!----- This is also code I got somewhere else to display the
    gallery ---->
    <cfif queryResults.recordcount gt 0>
    <cfoutput>
    <p class="style1">
    <!--- if past start --->
    <cfif (start-step-step) gt 1>
    <a href="#cgi.SCRIPT_NAME#?start=1"><img
    src="images/Beginning_blue.png" alt="Beginning" width="31"
    height="21" align="absbottom" /></a>
    </cfif>
    <cfif start gt 1>
    <a href="#cgi.SCRIPT_NAME#?start=#start-step#"><img
    src="images/previous_blue.png" alt="Previous" align="absbottom"
    /></a>
    </cfif>
    <strong>#start# - #iif(start * 3 + step gt
    queryResults.recordcount,queryResults.recordcount,start + step-1)#
    of #queryResults.recordcount# records</strong>
    <!--- if still some not displayed --->
    <cfif (start + step) lte queryResults.recordcount>
    <a href="#cgi.SCRIPT_NAME#?start=#start+step#"><img
    src="images/next_blue.png" alt="Next" align="absbottom"
    /></a>
    </cfif>
    <cfif (start+step+step) lte queryResults.recordcount>
    <a
    href="#cgi.SCRIPT_NAME#?start=#queryResults.recordcount-step+1#"><img
    src="images/end_blue.png" alt="End" align="absbottom"
    /></a>
    </cfif>
    </p>
    </cfoutput>
    </cfif>
    <cfloop query="queryResults" startrow="#start#"
    endrow="#start + step/3-1#">
    <table width="100%" border="1" bordercolor="#FFFFFF"
    cellspacing="0" cellpadding="2">
    <tr> <cfoutput query="queryResults"
    startrow="#start#" maxrows="3">
    <td width="33%"
    class="style1">#queryResults.ART_TITLE#</td>
    </cfoutput>
    <cfset #start# = #start# + 3>
    </tr>
    </table>
    </cfloop>
    </td>
    </tr>
    </table></form>
    It seems that the CATEGORIES filter is the only one that does
    not return a ERROR EXECUTING DATABASE QUERY error. However, it does
    not filter all the records... it only seems to filter and return
    the first 4 or 5 records.
    Any thoughts?

    your queryResults query selects only from ART table, while in
    the WHERE
    clause you are apparently using other tables whihc are not in
    your FROM
    clause...
    you need to use JOIN/INNER JOIN/LEFT JOIN/RIGHT JOIN in your
    FROM clause
    to link the other tables. check your db manual for proper
    usage of those
    operators.
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/

  • How To Count Filtered Records

    Hi
    We have a report, which has a couple of sections in it, and are trying to include a count in the summary section, which should correspond to the number of records shown in the detailed section.
    The detailed section has a filter applied, and that filter is not being taken into account in the Count at summary level.
    How do I get the Count() function to count records after the filter has been applied.
    The structure of the Webi looks something like this:
    Report Body
    > Section on Source Vendor Country Key
       >> Text
       >> Count (This should show the count of the underlying items)
       >> Section on Source Vendor Key
          >>>> Block of Data 1
          >>>> Block of Data 2
          >>>> Filter on Section on Source Vendor Key
    The "filter on Section on Source Vendor Key" restricts the data in that section, and does it's work correctly
    The "Count" in the top section is supposed to count the number of times Block of Data 1 is returned, but is showing that count regardless of whether the filter is applied or not. In other words, if I apply the filter, I see a count of 2, and if I remove the filter, I also see a count of 2. If the filter is applied, only 1 set of data comes back, so I want that Count to show 1 when the filter is applied.
    Any ideas?
    Cheers,
    Andrew

    Have you tried using the count as below?
    =count(object) in Block
    Thanks,
    Karthik

  • Filtering values in BMM layer

    Hi All,
    can we filter values or add filter condition for logical column in the BMM layer, i could see we can add where condition only in LTS of the logical table, i could see we could use FILTER display function but it can be used only with measure, i want to filter store values which is a dimension, is there any way round we could do this without creating any extra aliases and extra logical table.
    Thanks,
    Sreekanth
    Edited by: JUPS on Sep 6, 2010 6:21 PM

    hi,
    1)Create one session variable by writing a query in initialization block like
    select 'order' ,order_name from order_dim where order_name like '%Abc%'
    2) Variable to be row-wise-initialization
    3) In report pull order_name and click on Filter-->Advanced-->convert to sql
    give condition like
    SRC_ORDER_LINES.ORDER_ID = (VALUEOF(NQ_SESSION.order))
    Let me know if this doesn't work
    Thanks,
    Saichand.v

  • Returning filtered records based on login password

    Hi,
    I'm using MySql / PHP / DW
    I have a 'login.php' page which has two fields USERNAME & PASSWORD, and a 'jobs.php' page which displays a list of Client's jobs.
    I need Client A to log in and only see Client A's jobs and so on for my various clients...
    I have two tables, USER and JOBS.
    USER TABLE
    client_id (primary key)
    username
    password
    access_level
    JOBS TABLE
    job_id (primary key)
    client_id
    client
    site
    install_date
    I need 'jobs.php' to display Client A's jobs based on the username and / or password he has entered.
    Do I have to create a query in MySql or can I achieve this within DW in recordsets or something? I'm very confused!
    Thanks

    I had to do something very similar using .asp and MSaccess many years ago, back then I had to create a query in Access which merged the two tables together and then I created a recordset from it in Dreamweaver. Can I replicate this using MySql / Phpmyadmin and have the query show up in Dreamweaver so I can create a recordset from it?
    Back to present day...How do I retrieve the id of a record?
    On the client records page I have entered this data below - can you tell me if this is correct? When I test it records are displayed but when I preview in browser the records page comes back empty.
    Simple view:
    Advanced view:

  • Extracting filtered records from aselect statement

    Hi, i have a query that produces an output like this:
    CONNECTED_LOAD M_LAST CIRCUIT_CODE SUBSTATION_CODE CLASSIFICATION
    95---------------------------9/25/2011-----52SM4----------------LNLRCN003SML-----------------S
    95---------------------------9/25/2011-----53SM4----------------LNLRCN003SML-----------------S
    75.6------------------------9/25/2011-----54LR4----------------LNLRCN003LDR------------------S
    98---------------------------9/25/2011-----57LR4----------------LNLRCN003LDR -----------------S
    26---------------------------9/25/2011-----57SM4----------------LNLRCN003SMN----------------S
    53.25----------------------9/25/2011-----59LR4----------------LNLRCN003LDR-----------------S
    95--------------------------10/25/2011----52SM4----------------LNLRCN003SML-----------------S
    95--------------------------10/25/2011----53SM4----------------LNLRCN003SML-----------------S
    75.6-----------------------10/25/2011----54LR4----------------LNLRCN003LDR-----------------S
    98--------------------------10/25/2011----57LR4----------------LNLRCN003LDR-----------------S
    26--------------------------10/25/2011----57SM4----------------LNLRCN003SMN-----------------S
    53.25----------------------10/25/2011----59LR4----------------LNLRCN003LDR-----------------S
    *115------------------------11/25/2011----52SM4----------------LNLRCN003SML-----------------S*
    *102------------------------11/25/2011----53SM4----------------LNLRCN003SML-----------------S*
    *75.6-----------------------11/25/2011----54LR4----------------LNLRCN003LDR-----------------S*
    *98--------------------------11/25/2011----57LR4----------------LNLRCN003LDR-----------------S*
    *46---------------------------11/25/2011---57SM4----------------LNLRCN003SMN-----------------S*
    *48.25----------------------11/25/2011----59LR4----------------LNLRCN003LDR-----------------S*
    115-------------------------12/25/2011----52SM4----------------LNLRCN003SML-----------------S
    102-------------------------12/25/2011----53SM4----------------LNLRCN003SML-----------------S
    75.6------------------------12/25/2011----54LR4----------------LNLRCN003LDR-----------------S
    98---------------------------12/25/2011----57LR4----------------LNLRCN003LDR-----------------S
    46---------------------------12/25/2011----57SM4----------------LNLRCN003SMN-----------------S
    48.25---------------------- 12/25/2011----59LR4----------------LNLRCN003LDR-----------------S
    The above result is obtained from this query: *(ORIGINAL)*
    WITH months AS (
    SELECT ADD_MONTHS(:V_DATE_FROM,LEVEL-1) m_first
    *,(ADD_MONTHS(:V_DATE_FROM, LEVEL-0 )-1) m_last*
    FROM dual
    CONNECT BY LEVEL < MONTHS_BETWEEN(:V_DATE_TO,:V_DATE_FROM) + 1
    *,load_per_month AS(*
    SELECT conn_load
    *,SUM(conn_load) max_conn_load*
    *,m_LASt*
    *,CIRCUIT_code, substation_code, classification*
    FROM ( SELECT substr(c1.CIRCUIT_code,1,5) circuit_code, max(c1.connected_load) conn_load,
    c1.classification, C1.substation_code, m_LAst
    FROM SPM_CIRCUITS c1 CROSS JOIN months
    WHERE c1.date_commission <= m_last
    AND ( c1.date_decommission > m_first
    OR date_decommission IS NULL)
    AND SUBSTR(c1.substation_code,6,4) IN ('N003')
    GROUP BY substr(c1.CIRCUIT_code,1,5),
    c1.classification, substation_code, m_LAst
    group by conn_load, m_last, CIRCUIT_code, substation_code, classification)
    SELECT NVL(SUM(NVL(conn_load,0)),0) connected_load,m_LASt
    *, CIRCUIT_code, substation_code, classification*
    FROM load_per_month
    WHERE conn_load = max_conn_load
    GROUP BY M_LAST, CIRCUIT_code, substation_code, classification
    ORDER BY m_LASt, CIRCUIT_code;
    Using the query below i get 484.85, which is the sum of all connected loads in the month of November or December (highest):
    WITH months AS (
    SELECT ADD_MONTHS(:V_DATE_FROM,LEVEL-1) m_first
    ,(ADD_MONTHS(:V_DATE_FROM, LEVEL-0 )-1) m_last
    FROM dual
    CONNECT BY LEVEL < MONTHS_BETWEEN(:V_DATE_TO,:V_DATE_FROM) + 1
    ,load_per_month AS(
    SELECT conn_load
    ,SUM(conn_load) max_conn_load
    ,m_LASt
    ,CIRCUIT_code, substation_code, classification
    FROM ( SELECT substr(c1.CIRCUIT_code,1,5) circuit_code, max(c1.connected_load) conn_load,
    c1.classification, C1.substation_code, m_LAst
    FROM SPM_CIRCUITS c1 CROSS JOIN months
    WHERE c1.date_commission <= m_last
    AND ( c1.date_decommission > m_first
    OR date_decommission IS NULL)
    AND SUBSTR(c1.substation_code,6,4) IN ('N003')
    GROUP BY substr(c1.CIRCUIT_code,1,5),
    c1.classification, substation_code, m_LAst
    group by conn_load, m_last, CIRCUIT_code, substation_code, classification)
    (SELECT MAX(connected_load)
    FROM
    SELECT NVL(SUM(NVL(conn_load,0)),0) connected_load
    ,m_LAst
    FROM load_per_month
    WHERE conn_load = max_conn_load
    GROUP BY m_LAst
    ORDER BY m_LAst
    ORDER BY m_LASt, CIRCUIT_code;
    Now, how could i display all the records for the month of November or December given that the ORIGINAL query gave 24 records. Hope this is understandable. Thanks

    Thanks guys! I have, atlas, created the query by trail and error whew!

Maybe you are looking for

  • ADD-ON missing in Phase "ADD-ON Selection"

    Hello All, We are in the process of updating our ERP 6.0 system (EHP4 FOR SAP ERP 6.0 / NW7.01) to EHP5. While running maintaince optimizer  got some warnings for 4 add-ons as below. Component C-CEE 110_604 without suitable Product Instance Software

  • Pass 2 parameter to report from form-URGENT!!

    I want to sene 2 parameter 1st parameter will send the p_where_clause and 2nd one will send one text the a certain text item in report. My 1st parameter is P_where_clause and 2nd Parameter is p_amount. Please help me. regards, shalauddin

  • IPhoto '11: Export (JPEG) size not working

    I keep all my photos taken with iPhone 4 in iPhoto '11 ver 9.42 (710.42). It is a very excellent app to mange my photos. Recently I need some photos from iPhoto for the use in my web project. So I export them in JPEG, choosing "high" quality and "lar

  • How to Modify bottom text in notification mail

    Hi Experts, I have an issue regarding sending mails from my portal. When any Notification mail is triggered from Portal to Users mails at the bottom of the mail in the Signature place they are getting company name as below: ABCDCompany Pvt Ltd, Chenn

  • Can't tap on Camera Roll in Photos

    Camera Roll is hidden and can not be tapped on to access. Even trying to scroll it down to touch - it still just bounces back up under the Albums gray area and can not be tapped on. The only way I can access the Camera Roll is in the Camera app. Does