Display totals of 0 when no rows problem

i have the following data
code code2 rank id
a1 red ff 1
a1 red ff 2
a1 red cm 3
a1 blue ff 4
a1 blue ff 5
a1 blue ff 6
a1 blue wma 7
I want to display this grouped as follows
a1 red ff 2
a1 red cm 1
a1 red wma 0
a1 red wmb 0
a1 blue ff 3
a1 blue cm 0
a1 blue wma 1
a1 blue wmb 0
i can retrieve the counted totals of id okay and include the wma, wmb rank but can only display them once not within each group of code, code2
Any Help?

Hi,
You're correct that you need an outer join.
If you make your present query an in-line view, it doesn't matter what's going on inside it: you can OUTER JOIN to the result set as you need to.
Try this
WITH
original_query  AS
select s.code, w.watch, r.code
       AS r_code -- Make names unique
       , count(*) amt
                         from  frs_station_assignments sa,
                        frs_stations s, frs_watches w, frs_firefighters f,
                        frs_ranks r
                       where r.code = f.rnk_code
                       and sa.fgt_id = f.id
                       and sa.stn_id = s.id
                      and sa.wch_id = w.id
                      and r.code in ('CM','FF', 'WMA','WMB')
                      and s.code = 'A1'
                      and w.watch in ('RED','WHITE','BLUE','GREEN')
              group by s.code, w.watch, r.code
              -- ORDER BY is done in main query
SELECT  code
,       colors.watch
,       r_code
,       NVL (amt, 0)
FROM    colors
LEFT OUTER JOIN  original_query oq
ON      colors.watch = oq.watch
order by code, watch, r_code;If you don't have a colors table (with one row for every possible color), you can use another in-line view:
WITH
colors  AS
    SELECT DISTINCT watch
    FROM  frs_watches
    WHERE ... -- If necessary
original_query AS ...
[PRE]
If frs_watches is the colors table, then take all references to it out of the big in-line view, and put them in the main query.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • SSRS Report - Group Totals are Zero when Group Row Hidden

    I have a report with one group called Counties. This group has a filter.
    I added code to produce the totals for Prior, Current and DistinctCount:
    Public Shared Dim grandTotal1 as Decimal = 0
    Public Shared Dim CountyTotal1 as Decimal = 0
    Public Function AddTotal1(ByVal b AS Decimal) AS Decimal
    grandTotal1 = grandTotal1 + b
    CountyTotal1 = CountyTotal1  + b
    return b
    End Function
    Public Function GetCountyTotal1()
    Dim ret as Decimal = CountyTotal1
    CountyTotal1 = 0
    return ret
    End Function
    Public Function GetGrandTotal1()
    Dim ret as Decimal = grandTotal1
    grandTotal1= 0
    return ret
    End Function
    Public Shared Dim grandTotal2 as Decimal = 0
    Public Shared Dim CountyTotal2 as Decimal = 0
    Public Function AddTotal2(ByVal b AS Decimal) AS Decimal
    grandTotal2 = grandTotal2 + b
    CountyTotal2 = CountyTotal2  + b
    return b
    End Function
    Public Function GetCountyTotal2()
    Dim ret as Decimal = CountyTotal2
    CountyTotal2 = 0
    return ret
    End Function
    Public Function GetGrandTotal2()
    Dim ret as Decimal = grandTotal2
    grandTotal2= 0
    return ret
    End Function
    Public Shared Dim grandTotal3 as Decimal = 0
    Public Shared Dim CountyTotal3 as Decimal = 0
    Public Function AddTotal3(ByVal b AS Decimal) AS Decimal
    grandTotal3 = grandTotal3 + b
    CountyTotal3 = CountyTotal3  + b
    return b
    End Function
    Public Function GetCountyTotal3()
    Dim ret as Decimal = CountyTotal3
    CountyTotal3 = 0
      return ret
    End Function
    When it runs, it gives me this:
    This works fine. But now I need to hide the details on the counties. I just need the line with the 15, 32 and the 9.
    I highlighted the group row, right clicked -> Row Visibility and changed it to Hide. But when I do this, my results are three zeros.
    I am at a loss now on how to just show the totals. Does anyone have any suggestions for me to try?
    cpemtp1

    Hi cpemtp1,
    Per my understanding that you just want to get the total display in the report and hidden the details, right?
    I have tested on my local environment and suggest you to create an new dataset and using the query below to get the Total of every country and then you can using the SUM() function to sum the total of all the country which meet the  conditions.
    Detail information below for your reference:
    Create an new dataset and using the query below to get the sum of every country meet the filter condition:
    Select a.PRIORYEAR,a.CUREENTYEAR ,a.Country from (select SUM(PRIORYEAR) as P1,SUM(CUREENTYEAR) as C1,Country
    from TableName
    group by Country) a
    where a.P1<=a.C1
    Create an new tablix under the button of the existing Tablix or you can just remove the old tablix as below
    Original Table:
    New designed total:
    If you still have nay problem, please feel free to ask.
    Regards
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • Display Total Row In Matrix

    Hi all!
    In my addon application I have Matrix with 10 columns (2 columns with column type Edit Text, 8 columns with column type checkbox) now In 8 columns with type checkbox I want to display Footer as form Id = 60207(Menu service/service Report/Response Time by assignee Report). How To do it?
    please give me the solution to display Footer(Total) of Matrix when the column have column type is checkbox.
    Thanks & Help Me

    Hi !
    Thanks for your reply! when using 2 matrixs have problem as follow:
    My Matrix has 10 columns so will appear horizonal scrollbar so it doesn't solved this problem. My Idea I will add row after the last row and display total but i have problem: 8 columns that i want to add total have column type is checkbox so I can't. HOw to convert column type only the my row? Or give me the other solution. THanks
    Edited by: Tao lao on Apr 8, 2008 12:02 PM

  • Problem in displaying total no of pages in Smartform

    Hello experts,
    I have a problem while displaying total no of pages in Smartform.
    When no of pages are more than 10 then in total no of pages , a * is shown till current page is 9, then after it is displaying correct no of pages.
    I am using &sfsy-formpages& to get total no of pages.
    Ex: Like if I have 12 pages to print then i am getting 1/, 2/, 3/* .......... 9/* then 10/12 , 11/12, 12/12.
    Do i have to write some code for that ?? Please give your inputs to get the total no of pages.
    Thanks !

    Hi,
    Try this.
    Page &SFSY-PAGE& of &SFSY-FORMPAGES(4ZC)&
    Thanks,
    Anitha A

  • Internal Server Error when Displaying Total No. of Pages in Oracle Reports

    Hello all,
    I've already posted an almost similar message in the Developer Tools forums but would like to post it again here since we think that this is a problem with the report server (Maybe we're missing a patch, a configuration value not set properly or resources are not enough like memory).
    We're using Oracle Reports Server ver10.1.2.0.2 and we're encountering an Internal Server Error when a particular report retrieves around 10K records which displays on each page the current page and the total no of pages. When we only display the current page, the report does not encounter any error.
    When we enabled the tracing options, it just showed that it encountered a Null pointer exception.
    [2006/7/13 11:1:4:703] Debug 50103 (EngineImpl:EngineImpl) : CInitEngine returns 0
    [2006/7/13 11:1:4:765] Exception 50125 (java.lang.NullPointerException
    at oracle.reports.engine.RWEngine.init(RWEngine.java:343)
    at oracle reports.engine.RWEngine.main(RWEngine.java:60)
    ): Internal error java.lang.NullPointerException
    And according to metalink (Doc Id:315228.1), we should just remove the total pages in our report. Problem is that this isn't an option for us. The document also mentioned about something about timeouts. We have already tried setting the request timeout parameter of the HTTP server to larger values but it still doesn't solve the problem.
    Is there a workaround for this?
    Any help would really be greatly appreciated.

    Hi All,
    We really need a workaround for this error. When we enabled the tracing options, it just showed that it encountered a Null pointer exception.
    [2006/7/13 11:1:4:703] Debug 50103 (EngineImpl:EngineImpl) : CInitEngine returns 0
    [2006/7/13 11:1:4:765] Exception 50125 (java.lang.NullPointerException
    at oracle.reports.engine.RWEngine.init(RWEngine.java:343)
    at oracle reports.engine.RWEngine.main(RWEngine.java:60)
    ): Internal error java.lang.NullPointerException
    HELP!

  • Have CS 5 Installed on my iMac and works ok. But installed on my new MacBook Pro it won't open NEF files from my Nikon D810. Displays NEF icons, but when I try and open them the response is: Make sure latest RAW updates are installed. If problem persists

    Have CS 5 Installed on my iMac and works ok. But installed on my new MacBook Pro it won't open NEF files from my Nikon D810. Displays NEF icons, but when I try and open them the response is: Make sure latest RAW updates are installed. If problem persists follow link: http://www.adobe.com/go/kb407111. Have installed Bridge 5.0.2.4; Raw Ref Version 7.0.0.308; DNG converter_8_7_1.dmg; Bridge 5.0.2 Update 2. Also same problem with Lightroom which I don't normally use. Lightroom_3_LS11_mac_3_6.dmg installed.

    In the link you posted it states that the Nikon 810 requires ACR 8.6 or newer.
    Version of ACR are specific to versions of Photoshop. You cannot use 8.6 nor even 7.0.in CS5.
    I believe that ACR 6.7 is the latest that will work with CS5, so make sure you have this installed and get rid of ACR 7.
    Having 2 versions of ACR will cause problems.
    You have already downloaded DNG Converter 8.7.1.
    Have you double clicked the DMG file to allow you to install DNG Converter on your computer?
    Be aware that DNG converter is a stand-along application and not a plug-in.
    You need to open DNG converter at select the FOLDER that contain your .NEF files.
    Don't open the folder and try to select individual files, it doesn't work that way.
    After converting your D810 files to DNGs you can then open the DNGs in CS5
    The problem is your camera didn't exist when CS5 & its version of ACR was developed.
    i don't use Lightroom, but the list mentions Lightroom 5.6 as needed to open D819 so your 3.6 version of LR won't cut it.

  • I have a 17" Macbook pro with flickering red and cyan(blue) lines across the screen. The issue disappears temporarily when I tap on the computer, and the problem does not occur when I use external display or try to screen capture the problem.

    I purchased my Macbook (17") through a certified apple tecnition in August 2012, it was refurbished and the motherboard was completely replaced. I do a lot of photo editing, but I have been unable to do so because of the red vibrating lines that interrupt my screen. The issue disappears temporarily when I tap on the computer, and the problem does not occur when I use external display or try to screen capture the problem. I brought the computer back to the technition I purchased it from and he said that it was a problem with my fan, so I have two new fans but the issue is still occuring. He says he doesnt know whats wrong. Does anyone have any information on this issue?
    Here is an image of the issue
    http://www.flickr.com/photos/67839707@N08/8884847081/

    I recommend having your Mac serviced by someone competent. A force sufficient to "blow apart" the fans was clearly excessive and may have damaged the display cable, as well as any number of other problems.
    Dust is properly cleaned with a vacuum, preferably one designed for computer service, and they are not cheap.
    Compressed air should never be used. It just blows dust everywhere, often into places where it can no longer be removed.

  • Display Total No of Rows displayed in footer -- Classic Table

    Hi Friends,
    I have a search page. I want to display total records selected in the footer.
    Like:
    Col1 col2 col 3
    ---- Repaired --------
    ---- Not Repaired -------
    ------ Repaired ------
    Total Records : 3
    I cant use column total in this case b coz i the column 2 is not numeric column.
    I can get the total no of rows using getRowCount, but i dont know how to display it in footer of perticular column.
    Can anybody pls help in this regards...
    Thanks & Regards,
    Ram

    Hi,
    i solvet it.. with littlebit changes to the same code.
    Its urgent requirement pls help.........
    I am using the following code
    int totRow = getTotalRowFromView(pageContext,webBean);
    OATableBean table = (OATableBean)webBean.findChildRecursive("telmarRepairDetailVO1");
    OAMessageStyledTextBean totBean = (OAMessageStyledTextBean) table.findChildRecursive("ResultDetail");
    String s1 = "Total Result: "+totRow;
    totBean.setAttributeValue(TABULAR_FUNCTION_VALUE_ATTR", s1);
    But the value is not set to the footer.
    Regards,
    Ram

  • Problem in displaying total text in total line

    Hi...I am facing problem in displaying total text in first column of total line. Width of first column is sufficient to display text "TOTAL". But somehow its not getting displayed....Please Help...?
    code is as follows:
    ls_layout TYPE  slis_layout_alv .
    ls_layout-totals_text       = 'TOTAL'.
      ls_layout-colwidth_optimize = 'X'.
      ls_layout-no_vline          = 'X'.
      ls_layout-no_hline          = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program     = gv_repid            " Report ID
          i_callback_top_of_page = 'TOP_OF_PAGE'
          is_layout              = ls_layout
          it_fieldcat            = gt_fieldcat         " Field Catlog
        TABLES
          t_outtab               = gt_cost_output      " Output Table

    hi me to i have the same problem
       FORM create_layout .
      data: text(20) TYPE c.
      it_layout-window_titlebar   = text.
      it_layout-colwidth_optimize = 'X'.
      it_layout-totals_text       = text-013."'Totals'(013).
      it_layout-cell_merge        = 'X'.
      it_layout-zebra             = 'X'.
    ENDFORM.         
    but no output total in alv
    also i had another broplem i had unit i wanna show it in total line and calc value in header

  • Problem in displaying totals based on the Unit of measurement.

    Hi,
    I have Problem in displaying totals based on the Unit of measurement.
    I want to display the total in the output of the alv based on the unit of measurement. for example i have three fields in the output namely
    Matnr           Quantity      UOM
    51                10              EA
    61                10              KG
    71                10              KG
    In the total i should get
                    10         EA
                    20         KG
    Can anyone tell me how to do this?
    The basic req is the exclude the qty with unit EA(each) in the totals.
    Thanks,
    Amit

    H i,
    you can use the collect statement
    to get the proper result
    loop at itab.  ( all the records)
    move all the fields from itab to another
    collect itab1.
    write: itab1-fields, itab1-fields.
    endloop.
    this will solve your problem
    reward points if helpful,
    thanks & regards,
    venkatesh

  • HT204150 I'm having problems with random contacts disappearing from icloud. I have a saved text from a contact that displays her info but when I look for her in contacts it's missing.

    I'm having problems with random contacts disappearing from icloud. I have a saved text from a contact that displays her info but when I look for her in contacts it's missing.

    It is locked to your sisters carrier.
    She would have to ask her carrier if they unlock iPhones and if she qualifies for this service.

  • Display TTITLE in SQL*Plus when no rows returned

    I need a SQL*Plus query that would display the TTITLE with Date. My query looked like this at first:
    column TODAY noprint NEW_VALUE p_date
    set feedback off
    select to_char(sysdate, 'mm/dd/yyyy') today from dual;
    set feedback on
    ttitle left 'query.sql' -
    center 'Department Listing ' -
    right 'Date: ' p_date skip 1
    select dept_code, dept_name
    from department
    where dept_code between 200 and 300
    When I run this query, if there's data returned, the title would display on every page.
    When there's no rows selected, the title would NOT display.
    So I moved the ttitle statements to ABOVE the select date section. When there's no rows selected the title would be displayed, where there's data selected, the title would be display TWICE on the first page which is very annoying.
    Then I added TTITLE OFF after the select date section and the query looked like this:
    column TODAY noprint NEW_VALUE p_date
    ttitle left 'query.sql' -
    center 'Department Listing ' -
    right 'Date: ' p_date skip 1
    set feedback off
    select to_char(sysdate, 'mm/dd/yyyy') today from dual;
    set feedback on
    ttitle off
    select dept_code, dept_name
    from department
    where dept_code between 200 and 300
    when no rows selected, the title displayed.
    when rows selected, the title displayed, ONLY ON THE FIRST PAGE.
    Does anyone have any creative ideas to get the ttitle to display: with or without return results, ONCE and on EVERY page?
    Thanks in advance!!!
    Jane

    Hi Jane,
    Just check out this answer might helps u.
    In the final code what u have written u placed the ttitle off above the sql statement for dept.
    Just note these points
    1.U r telling the TTITLE OFF before SQL For Department
    2.In both cases(With Data/Without Data) u r able to see the title once that is of select statement for date.
    so there is no title for Select statement for department
    What ur code telling is U have written a TTITLE that is for Selection of Date not for the Selection of department.
    So in both cases u r getting the title once.
    Put the TTITLE OFF at the end that is after Select stmt of department
    then u will get title for each page.
    In the first Script u told that it is displaying twice(annoying)
    It will display like that only coz there are two select statements in ur Script.
    TTITLE means it will display once on each page per query.
    one is for select statement of date(it will display once because that query result is max of one line)
    second is for select statement for Department(it will display one title in each page)
    so u will find two titles on first page.
    Hope this will clear u
    Revert back for any more clarifications
    Regards
    Kiran

  • Problem in displaying total quantity

    For VA02 Transaction:
    When order contains 1 line item it is displaying fine. If order contains more line items total quantity of line items is not displaying, previously itu2019s working fine. I written perform at Item_line element to display line items and I written perform at Item_sum element to display the total quantity. (in debugging for one item 2 elements are triggering ,  when more line items item_sum element is not triggering).
    Please can u help me to display total quantity. And why item_sum element is not triggering.
    Thanks & Regards,
    Raj

    Hi,
    you meant, its not displaying the correct value or it is not at all printing any value in total when u have multiple line items.
    could you paste the code for this part...
    Rgds,
    Pavan

  • Using apple iphone 5, i observe today that display shows yellow border when i choose option in setting as erase all content and setting, iphone goes in to starting mode, i want to know is there any problem to display, plz give me feed back urgently

    using apple iphone 5, i observe today that display shows yellow border when i choose option in setting as erase all content and setting, iphone goes in to starting mode, i want to know is there any problem to display, plz give me feed back urgently

    I had this same thing happen to me.  I was using my brand new iphone 5 (texting and listening to music through the speakers) when it flashed the apple logo, stopped my music and brought me to the lock screen. 

  • Hello, I uploaded a new website but all the svg files don't display on the browsers. when I open it in Muse with the "preview in browser", its fine! can someone tell me please where my problem is? (sorry for my english!)

    hello, I uploaded a new website but all the svg files don't display on the browsers. when I open it in Muse with the "preview in browser", its fine! can someone tell me please where my problem is? (sorry for my english!)

    Hi
    Could you please check this thread, it might be helpful
    Muse not exporting svg, can only see in preview

Maybe you are looking for

  • My Finders not working and my Desktop items are gone on my MacBook Pro!?

    Basically yesterday I had a debugger state: panic or something like that and i couldnt get passed the apple logo on load up before this whole bunch of numbers and letters come up and my whole macbook just blew up pretty much. I went into recovery hd

  • Problem in embedding view

    Hi, I have view container being dynamically generated . My requirement is to embed a standard view in it at run time. Please help me out. Thanks&Regards, Narendra N Shukla

  • IMac G5 no longer able to use Microsoft Office 2004

    I have had Microsoft Office 2004 installed on my G5 for several years but I am not able to access any of the Microsoft applications anymore. I get the following message when trying any of the Office applications: "Microsoft (Entourage, or whatever) h

  • Synchronisation error 0x809909B0

    I have a Data Protection Manager 2012 r2 server (rollup 3) trying to back up a client server. I get the error below. The protection agent on <backed up server> was temporarily unable to respond because it was in an unexpected state. (ID 60 Details: I

  • DATALOAD.ERR: Can the default location of this file be changed?

    DATALOAD.ERR: Can the default location of this file be changed? I couldn't find any indication that this is possible in the Admin manual.Thanks!Vladimir Stojanovski Independent Consultant [email protected]