Counter not working

I'm trying to count the number of categories in my database. The problem is that my Counter "Count" is always returning zero but I have check ths database and there are a few different categories
String theSQL = "Select category From Archive";
int Count = 0;
ResultSet rset;
rset = stmt.executeQuery(theSQL);
while(rset.next() == true)
String Cat = rset.getString("category");
Count ++;
conn.close();
return Count;

I'm trying to count the number of categories in my
database. The problem is that my Counter "Count" is
always returning zero but I have check ths database
and there are a few different categories
String theSQL = "Select category From Archive";
int Count = 0;
ResultSet rset;
rset = stmt.executeQuery(theSQL);
while(rset.next() == true)
String Cat = rset.getString("category");
Count ++;
conn.close();
return Count;Perhaps your while statement never gets executed, i.e. rset.next() never == true. Put an indicator in your while loop to ensure it's executing. I usually do something like
System.out.println("Hey moron, your while loop is executing now and count = ", count);but I tend to be a little self deprecating at times.

Similar Messages

  • Read Only Display of Radio group and Text area with counter not working

    Hello,
    I am using Apex 3.2, with 10g for the database
    I have this form, with fields that will set to read only when status = 'closed'
    All of the fields display as read only except for 2. I cannot figure out why this is not working correctly.
    1st field is Issues that is a text area with character counter, with a sql query behind it, that is set to null unless the query is pulling in the data.
    2nd field is Status which is a radio group that will not display as read only when status = 'closed'
    I have other fields on the form with the same format and they change to read only when the status = 'closed', I have even copied the pl/sql expression from one field to these fields and it still doesn't work correctly. I have also tried javascript for an on load event, which works, but once I click on the save button, it disables all of the page items, which works correctly, but I purposely forget to enter information, to make sure the validations are firing correctly, which it does, but the script disables everything, not allowing me to correct the errors. The javascript is firing on the on page load event.
    Any help on this is greatly appreciated.
    Mary

    Dung,
    That API seems to have a bug, it returns true/false/null, so you could use 'return not nvl(htmldb_util.current_user_in_group(p_group_name => 'APP Admin'),false)' to get a false value.
    Unfortunately there's another problem: using the read-only attributes for checkbox or radiogroup item makes them hidden. My suggestion would be to create another item that has disabled="disabled" in the HTML Form Element attribute in the item definition and display that item or the non-disabled item alternately, using conditions based on the current_user_in_group logic.
    Scott

  • Badge count not working on reminder after IOS8 upgrade.

    Hello,
    after upgrade my iPhone 5s (64) to IOS8 last weekend, the badge count (only for the reminder!?) does not work.
    Deactivating / activating did not helps.
    Note: Reminder works with iCloud sync
    Thanks for any answer,
    Dirk

    same here: https://discussions.apple.com/message/15712300#15712300

  • Select count(*) not working in Apex

    Hello,
    The following sql works in both SQL*Plus and Toad but not in apex.  The variable seems always to be 0 no matter what data I have on the table.
    Basically I try to flip the status from "Inactive" to "Active" only when there is no "Inactive" status left on the table.  Say there are 2 inactive statuses.
    If I delete one inactive status, the overall status should still be "Inactive".  However, with this code, it flips to "Active" status regardless. 
    I tried manually assign the variable to 1 and the status was not flipped.  Therefore, it sounds to me that the count(*) is not working in APEX.
    Does anyone experience this before? 
    Thanks in advance,
    Ning
    ===================================
    DECLARE
    v_status_count NUMBER;
    BEGIN
    UPDATE LGR_APP_STATUSES
    SET DELETED = 'Y'
    WHERE LGR_APP_STATUS_ID = :P42_LGR_APP_STATUS_ID;
    commit;
    select count(LGR_STATUS_ID) into v_status_count from LGR_APP_STATUSES
    where DELETED = 'N'
    and LGR_APPLICATION_ID = :p42_application_id
    and LGR_STATUS_ID in (3,8);
    IF (v_status_count = 0) THEN
    update lgr_applications
      set lgr_application_status = 'ACTIVE'
      where LGR_APPLICATION_ID = :P42_LGR_APPLICATION_ID;
    commit;
    END IF;
    END;

    Hi,
    In query you have used p42_application_id.
    Other statements use P42_LGR_APP_STATUS_ID
    Do you have that item? What is session state for that?
    Regards,
    Jari

  • Select and Count not working.....HELP PLEASE!!

    I have the following scenerio:
    SELECT #PART,#PDESC,COUNT(#PART) AS PCOUNT FROM MYLIB WHERE #PART LIKE 'AN101011%' AND #RECDT BETWEEN 19970826 AND 20020826 GROUP BY #PART,#PDESC
    //brings back count of 1 which is right...only one part within the date range
    PCOUNT: 1
    SELECT #PART,#PDESC,COUNT(#PART) AS PCOUNT FROM MYLIB WHERE #PART LIKE 'AC043208%' OR #PART LIKE 'AN101011%' AND #RECDT BETWEEN 19970826 AND 20020826 GROUP BY #PART,#PDESC
    //looped through result set and these two counts are right
    PCOUNT: 1
    PCOUNT: 1
    SELECT #PART,#PDESC,COUNT(#PART) AS PCOUNT FROM MYLIB WHERE #PART LIKE 'AN101011%' OR #PART LIKE 'AC043208%' AND #RECDT BETWEEN 19970826 AND 20020826 GROUP BY #PART,#PDESC
    //now brings back a pcount of 2 for the first part which is shouldn't, there are two parts with the same number but only one which falls within the date range.
    PCOUNT: 2
    PCOUNT: 1
    could anyone help me with this.....thanks in advance

    Found the solution....its in the order of processing of the select statement...for others future reference....
    SELECT #PART,#PDESC,COUNT(#PART) AS PCOUNT FROM MYLIB WHERE #PART LIKE 'AN101011%' AND #RECDT BETWEEN 19970826 AND 20020826 GROUP BY #PART,#PDESC
    //brings back count of 1 which is right...only one part within the date range
    PCOUNT: 1
    SELECT #PART,#PDESC,COUNT(#PART) AS PCOUNT FROM MYLIB WHERE #PART LIKE 'AC043208%' OR #PART LIKE 'AN101011%' AND #RECDT BETWEEN 19970826 AND 20020826 GROUP BY #PART,#PDESC
    //looped through result set and these two counts are right
    PCOUNT: 1
    PCOUNT: 1
    //*****this works because in actual fact it is reading the date range and it associates it with the last part number so it reads it like this (note the brackets):
    SELECT #PART,#PDESC,COUNT(#PART) AS PCOUNT FROM MYLIB WHERE #PART LIKE 'AC043208%' OR (#PART LIKE 'AN101011%' AND #RECDT BETWEEN 19970826 AND 20020826) GROUP BY #PART,#PDESC
    SELECT #PART,#PDESC,COUNT(#PART) AS PCOUNT FROM MYLIB WHERE #PART LIKE 'AN101011%' OR #PART LIKE 'AC043208%' AND #RECDT BETWEEN 19970826 AND 20020826 GROUP BY #PART,#PDESC
    //now brings back a pcount of 2 for the first part which is shouldn't, there are two parts with the same number but only one which falls within the date range.
    PCOUNT: 2
    PCOUNT: 1
    //***this did not work because the date range only applied to the last part number not the first..so it read it like (note the brackets):
    SELECT #PART,#PDESC,COUNT(#PART) AS PCOUNT FROM MYLIB WHERE #PART LIKE 'AN101011%' OR (#PART LIKE 'AC043208%' AND #RECDT BETWEEN 19970826 AND 20020826) GROUP BY #PART,#PDESC
    //**Therefore, I changed it to (including the brackets) and it ran fine:
    SELECT #PART,#PDESC,COUNT(#PART) AS PCOUNT FROM MYLIB WHERE (#PART LIKE 'AN101011%' OR #PART LIKE 'AC043208%') AND #RECDT BETWEEN 19970826 AND 20020826 GROUP BY #PART,#PDESC

  • Spry textarea character count not working in IE9

    Hi.
    I'm using DW CS5 for a ColdFusion form with a textarea field. The spry character count works in every browser but IE9. Anyone know how to fix this?
    Thanks!

    This feature will not work in IE9 and IE10.
    The problem is two-fold
    a) The Copyright notice shows 2006 as the last Spry update. This was around the time of IE7
    b) Microsoft tends to go off on a tangent where every release of IE behaves differently
    As always, we are in the hands of the Adobes and Microsofts.

  • Counter not working in Muse slideshow

    I created a slideshow and added 6 images. When I adjusted design and added additional images counter stopped working in slideshow.

    Hi I am having a very similar problem but in this case relating to captions.
    I have encountered the same error as above, but after a while of re-jigging things around it seemed to unfreeze and recognise the placing in the sequence. A problem which I have encountered at the same time, and hasnt fixed, even when using different version of the lightbox / slideshow widget is how to add different captions to each image. This is easy on the design tab, but when previewing only one of the captions (generally the current one) shows. I have togled edit together, and tried building the widget placing all content in and then unchecking 'edit together' to deal with the captions seperately at the end, but to no success.
    Is there a solution or has anyone encountered the same issue!!?

  • Skin counter not working

    Hello
    I am trying to modify one of the Adobe provided flv skins, but when I do the counter is disabled.  Even if I just copy the fla and export the swf skin, without making any modifications, the counter is disabled.  Do I need to add code to make it work?
    Thanks
    Dave

    We need some more information in order to help you.
    What version number of Aperture and of your operation system?
    How are you "doing" skin smoothing?  What do you expect to happen?  How is this different from what does happen?  How are verifying that it is isn't working correctly?
    Has it ever worked in the past?
    Can you post a screen-shot illustration any of the above?
    Do you have any other trouble with Aperture?  With any other programs?
    Do other Aperture Quick Brushes work?
    Have you tried any troouble-shooting?  Have you re-started Aperture?  Have your re-started your system?
    Post back with this information and I'm sure some of the many helpful people here will provide some direction and tips.

  • Hit Counter Not Working :(

    I want to add the "hit counter" on my welcome page, but when I go to publish it...it does not appear. It doesn't even appear on iWeb. What am I doing wrong??

    SPV:
    Welcome to the Apple Discussions.
    Is it still linked to the old site?
    If you published you site to your second .Mac account then you'll have tow versions of it out there. One on the first account and the one on the new account. They will have different URLs as the default URL will be:
    http://homepage.mac.com/.Mac account name/
    So unless you deleted it from the first account each account will have that site. If you don't want the site on the first account go to the iDisk/Web/Sites/iWeb folder for that account and look for the folder with the sites name and delete it. There will be an index.html file there also you can delete.
    Do you Twango?

  • Web Counter Not Working

    Tried the 150 px footer but still didn't work - any ideas why the counter won't show on my home page?

    Hi
    Please find the link given below might help you.
    Fixing Webcam Problems in Windows 7
    Webcam Troubleshooting (Windows 8)
    Let us know how it goes!
    "I work for HP."
    ****Click the (purple thumbs up icon in the lower right corner of a post) to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    Regards
    Manjunath

  • Music Count Not Working

    I was hoping someone could help me with this problem I'm having.
    I'm using an Original Edge iPhone.
    Starting yesterday my music count has been a bit wacko. Every time I'm listening to a song it says "1 out of 101" even though I'm like...on the 50th song. I'm starting from "songs," so it isn't due to me going by album or artist. Also, after a song is finished, it goes to a random song next--in no absolute order.
    Help please!

    For the first problem, try doing a reset which is done by pressing and holding the home button and the sleep/wake or on/off button simultaneously until you see the Apple logo and then release - ignoring the slide to turn off prompt when doing so.
    For the 2nd problem, start playing a song. Select on the album coverart area to bring up the time remaining indicator for the song. To the right of the time remaining indicator is the Shuffle icon. If selected, the color of the icon is blue. If blue, select it once to turn Shuffle off. The color of the icon is white when off.

  • Forwarding port for Counter-strike: Source is not working

    With my linksys router (Model WRT54G)I tried forwarding my port for a Counter-Strike: Source server. My friends tried it after I tried forwarding the ports and it did not work. It looks like this: |Application|Start|End--|Protocol|Ip-Adress------|Enabled| |CS1--------|1200-|1200-|Both----|192.168.1.[105]|Check--| |CS2--------|2700-|27015|Both----|192.168.1.[105]|Check--| |CS3--------|27020|27039|Both----|192.168.1.[105]|Check--| I can get on the server but my friends can not. And yes, I did uncheck "Block Anonymous Internet request". Message Edited by Iridium on 08-16-2007 07:37 PM Message Edited by Iridium on 08-16-2007 07:38 PM
    Message Edited by Iridium on 08-16-2007 07:38 PM

    Is the IP address 192.168.1.105 really the IP address of the server in your LAN?
    Moreover, check what kind of modem you have. Follow the instructions here. If the IP address on the status page is a private IP address and the IP address on whatismyipaddress.com is different then your modem does routing too and you have to configure port forwarding there as well.

  • Count (case when) not working in sql

    Hi All,
    I am trying to find the count of members for a perticular date range, it seems not working correclty.
    Could any one help me out.
    here is the query...I am getting same output for all the cases..please help
    Select
    t
    .MemberNbr,t.patcom
    count(case
    when
    datediff(d,
    mbrs.DischargeDate,
    convert(datetime,convert(varchar(12),t.specificdateofservice),112))
    between
    -1
    and
    -365
    then t.MemberNbr
    else 0
    end)as
    edvisits365daysprior
    count(case
    when
    datediff(d,
    mbrs.DischargeDate,
    convert(datetime,convert(varchar(12),t.specificdateofservice),112))
    between 1
    and 3
    then t.MemberNbr
    else 0
    end)as
    edvisits3Days
    count(case
    when
    datediff(d,
    mbrs.DischargeDate,
    convert(datetime,convert(varchar(12),t.specificdateofservice),112))
    between 1
    and 30
    then t.MemberNbr
    else 0
    end)as
    edvisits30Days
    count(case
    when
    datediff(d,
    mbrs.DischargeDate,
    convert(datetime,convert(varchar(12),t.specificdateofservice),112))
    between 1
    and 60
    then t.MemberNbr
    else 0
    end)as
    edvisits60Days
    count(case
    when
    datediff(d,
    mbrs.DischargeDate,
    convert(datetime,convert(varchar(12),t.specificdateofservice),112))
    between 1
    and 90
    then t.MemberNbr
    else 0
    end)as
    edvisits90Days
    --,*--membernbr,specificdateofservice,count( membernbr)--, specificdateofservice)as visitcount--, patcom
    --Into #Tmp_PPCSEDCnt1
    From
    stg_tbl_InPatientPrepost Mbrs
    join
    #Tmp_MCCSEDVisits t
    on
    mbrs.MemberNbr=t.MemberNbr
    --where UPPER(t.MR_Line_Desc) in ('FOP EMERGENCY ROOM - HOSPITAL', 'FOP EMERGENCY ROOM Urgent Care',
    --'PROF ER VISITS AND OBSERVATION CARE')
    group
    by t.MemberNbr,t.patcom

    You may replace 0 as NULL and see how it works for you?
    eg:
    count(case when datediff(d, mbrs.DischargeDate,
    convert(datetime,convert(varchar(12),t.specificdateofservice),112)) 
    between -1 and -365 thent.MemberNbr else NULL end)as edvisits365daysprior

  • Work approval count not matching in WCAW and WCL9

    Hi Team,
    I am trying to check the count of Work approvals created within a date range and validate it using tables.
    I am using the WCAW table to get the count of the work approvals by passing the Maintenance Plant (IWERK) and the created date (CRDAT).
    In WCL9, I am passing the Plant again and the valid from date. I am getting the count by using the Settings> List status.
    In the table I am getting 2801 as the count and through the tcode I am getting 2800 as count.
    Can you please help me to understand as to why there is a difference in the count.
    Please help.
    Thanks,
    Beryl

    Hello,
    Yes. You are right. All items would show all the documents that have posting date in the given range.
    Even if you create a document today with pas posting date, it would come in all items list.
    If a document is cleared on a particular day, it would come in cleared list as on that date. If you give one day before, it would show as open item.
    Technically, an item is open and cleared on clearing date.
    EG: At 10 am, item is open. You clear the item after 10 am, status would be cleared after 10. Since SAP dont track clearing time, item would be shown as cleared as on clearing date.
    Note: All items option will always show current status of the item. If you want the status as on particular date, please try open items at key date/cleared items at key date options.
    Post a doc on 15.04.14 with posting date 01.04.14, clear it on 16.04
    Open items option as on 01.04 or 15.04-Shown open
    Cleared item option as on 01.04 or 15.04- No result, as on 16.04, cleared
    All items as on 01.4 to 15.04 (Run on 15.04) -Shows Open, Run on 16.04 with same dates-Shows cleared (Current status)
    You can try posting one document and run with different options to understand better.
    Hope the concept is clear
    Thanks,
    V V

  • COUNT() and SUM() function it not working in XDO file.

    Hi ,
    I am getting one error. Count and sum function not working proper.
    For example :
    Department 10 have 3 employee and total salary is 8750. But my report returning total employee 1 and total salary 5000
    10
    Ename Sal
    KING 5000
    CLARK 2450
    MILLER 1300
    ==================
    total employee : 1
    total salary : 5000
    Kindly help me solve this problem.
    <dataTemplate name="TEXT">
    <properties>
    <property value="upper" name="xml_tag_case" />
    </properties>
    <lexicals>
    </lexicals>
    <dataQuery>
    <sqlstatement name="Q_TEMP">
    <![CDATA[SELECT DEPTNO,DNAME,LOC FROM DEPT]]>
    </sqlstatement>
    <sqlstatement name="Q_TEMP1">
    <![CDATA[SELECT ENAME,HIREDATE,SAL FROM EMP WHERE DEPTNO = :DEPTNO]]>
    </sqlstatement>
    </dataQuery>
    <datastructure>
    <GROUP name="G_1" source="Q_TEMP">
    <element value="DEPTNO" name="DEPTNO" />
    <element value="DNAME" name="DNAME" />
    <element value="LOC" name="LOC" />
    <GROUP name="G_2" source="Q_TEMP1">
    <element value="ENAME" name="ENAME" />
    <element value="SAL" name="SAL" />
    <element value="G_2.ENAME" name="TOTL_DETAILS" dataType="number" function="COUNT()" />
    <element value="G_2.SAL" name="TOTL_SAL" function="SUM()"/>
    </GROUP>
    </GROUP>
    </datastructure>
    </dataTemplate>
    Thanks
    Yudhi

    Please have the data structure as below:
    <datastructure>
    <GROUP name="G_1" source="Q_TEMP">
    <element value="DEPTNO" name="DEPTNO" />
    <element value="DNAME" name="DNAME" />
    <element value="LOC" name="LOC" />
    <GROUP name="G_2" source="Q_TEMP1">
    <element value="ENAME" name="ENAME" />
    <element value="SAL" name="SAL" />
    *</GROUP>*
    *<element value="G_2.ENAME" name="TOTL_DETAILS" dataType="number" function="COUNT()" />*
    *<element value="G_2.SAL" name="TOTL_SAL" function="SUM()"/>*
    *</GROUP>*
    </datastructure>
    Aggregate functions to be placed at the level you require it. Here you need at G_1, so place it there.

Maybe you are looking for