Help Counting Records in an Array

I had a friend help me build this but now he's gone and I
don't understand arrays or coldfusion really. I have an image
gallery that works beautifully except that I want to be able to add
two behaviors to the page. 1.Pagination. 2. Display Record Count.
(I know how to use the Dreamweaver built in Server Behaviors with
Dynamic Tables but this is a little different from that b/c he's
using arrays to build the table instead. I've almost go the
pagination working. Except I can't figure how to show the last
record. I've got "First, Next, & Previous" to work. But the
"Last" doesn't. This is the part of the code that I'm concerned
with as everything else is working.
<cfset CountUp=Count + 10>
<cfset CountDown=Count - 10>
<p align="center"><cfif Count gte 10><a
href="gallery.cfm?Count=<cfoutput>#CountDown#</cfoutput>">Previous</a></cfif>  <cfif
ArrayLen(PhotoArray) gt CountUp><a
href="gallery.cfm?Count=<cfoutput>#CountUp#</cfoutput>">Next</a></cfif>  <cfif
ArrayLen(PhotoArray) lt CountUp><a
href="gallery.cfm?Count=<cfoutput>#CountUp##CountDown#</cfoutput>">Last</a></cfif>

I'm a both actually. I am trying to get back into programming with Java and it has not been easy.
I tried using
for (int i=0; i<s.length; i++ )
System.out.println(s.length());This worked perfecty, but it completely bypasses my method. How do i envoke the method or rewrite the method in order to use it?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • How to get the record set into array?

    Hi,
    I want to get the record set into array in the procedure and do the processing of the array later in procedure.
    below is the stored procedure i am working on:
    procedure bulk_delete_group(p_group_id in Array_GroupListID) as
    begin
    for i in p_group_id.first..p_group_id.last loop
    --Here I have to get the list of user id before deleting group
    SELECT user_id into *<SOME ARRAY>* FROM group_members WHERE group_id = p_group_id(i);
    DELETE group WHERE group_id = p_group_id(i);
    --Process the user id array after group deletion..
    end loop;
    end bulk_delete_group;
    Thanks in advance
    Aditya

    Something like this ->
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    Elapsed: 00:00:00.20
    satyaki>
    satyaki>
    satyaki>select * from emp;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          9999 SATYAKI    SLS             7698 02-NOV-08      55000       3455         10
          7777 SOURAV     SLS                  14-SEP-08      45000       3400         10
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       4450                    10
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       7000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
    13 rows selected.
    Elapsed: 00:00:02.37
    satyaki>
    satyaki>create type np is table of number;
      2  /
    Type created.
    Elapsed: 00:00:03.32
    satyaki>
    satyaki>Create or Replace Procedure myProc(myArray np)
      2  is
      3    i   number(10);  
      4    rec emp%rowtype;  
      5  Begin  
      6    for i in 1..myArray.count
      7    loop  
      8      select *  
      9      into rec 
    10      from emp 
    11      where empno = myArray(i); 
    12     
    13      dbms_output.put_line('Employee No:'||rec.empno||' Name:'||rec.ename); 
    14    end loop; 
    15  End myProc;
    16  /
    Procedure created.
    Elapsed: 00:00:00.88
    satyaki>
    satyaki>
    satyaki>declare
      2    v np:=np(9999,7777);  
      3  begin  
      4    myProc(v);  
      5  end;
      6  /
    Employee No:9999 Name:SATYAKI
    Employee No:7777 Name:SOURAV
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.30
    satyaki>Regards.
    Satyaki De.

  • Counting records in Visual Composer

    Hi folks,
    I do have question I cannot find a solution ( maybe due to christmas turkey paralysis )
    I am using VC to call a RFC function in ERP system 'RFC_READ_TABLE' to access data from table.
    The table I access is a customer table containing Delta- Data
    Actually the system RFC function returns all records ( normally between 1 and 10 records).
    On VC side I'd like to display only the number of records to inform if new data is available.
    How can I count records internally in VC?
    ( I do not like to bring in data directly into BI because the application I write will merge BI Query data with non BI data)
    I'D like to use standard RFC function to receive data, but first hand I'd like to decide by number of entries whether to use data or not.
    Any help is appreciated
    TIA

    Hi Prachi,
    that's it.
    I never used that functionality for plain counting records being returned by tables
    It woks perfect.
    The glory shiny points are yours.
    Joerg

  • Mysql database, counting records

    Hi!
    I have to store measured data to MySQL database. During this process I would like to count a number of records in a database table. It is also necessary to filter records. I'm using the SQL statement as follows:
    SELECT COUNT (fieldname) AS cnt FROM table WHERE condition
    Because I haven't got any result I've created a small database "mysweetdb" and table "icecream" to test my VIs (see picture bellow).
    The VI is attached. The result of counting is a 2D array (DB Tools Fetch Recordset Data.VI output) with one element (one row and one column). This element contains no data.
    I usually don't give up easily so I've created a similar MS ACCESS database and counted data in it. I've got a correct answer: 3. So it might be possible that there is something wrong with MySQL driver. But I've created a small Delphi project and I've counted records in MySQL database and MS ACCESS database. Both results were correct.
    Can anyone explain where is the problem in communication between LabView and MySQL database?
    Versions: XAMPP for Windows 1.7.3, LabView Developer Suite 2010 SP1, MySQL 5.1 ODBC driver
    Thanks in advance for your suggestions.
    Attachments:
    Count records.vi ‏19 KB

    ContDivConsult,
    thank you for your answer. An updated version of my VI is attached. It uses two options: LabSQL library and DB Connectivity Toolkit. LabSQL gives correct results.
    Regards,
    Ljubo.
    Attachments:
    Count records.vi ‏25 KB

  • Inserting a record into an array

    I have an applet that pops up different frames when you click on a menu item. On my add a record frame I have a number of textfields and an add button. When the button is clicked it is supposed to insert the record into my array of objects that only can have 3 records. When the button is clicked however I get a null pointer exception. I want to add the record in order based on the employee number, so first I want to check to see if the first spot of the array is null and add the record in the first spot if it is. If it isn't I want to check the employee numbers and insert the the record in the correct place and make sure the array isn't full. Can someone help me out 1. Why the nullpointer exception. 2. I am not sure if my logic is correct. Below is the Code. Thanks!!
    public void insertRecord()
    if (MyEmpArray[0] == null )
    addRec(0);
    else
    for(int index =0; index <3; index++)
    if(intEmpNumber < MyEmpArray[index].intEmpNumber && MyEmpArray[3] != null )
    addRec(index);
    else
    lblErrorMessage.setText("Array is full");
    public void addRec(int index)
    MyEmpArray[index].setValues(intEmpNumber, strFirstName, strLastName, strHomePhone,
    strStreet, strCity, strState, strZip, strCountry, strWorkStreet,
    strWorkCity, strWorkState, strWorkZip, strWorkCountry, strWorkPhoneNum,
    fltNumHours, fltHourlyWage, intI, intJ, intK);
    lblErrorMessage.setText("");
    txaReport.setText("");
    ClearFields();
    }

    for(int index =0; index <3; index++)
    An array with an index from 0 to 3, contains 4 records: you should replace it with
    for(int index =0; index <2; index++)
    The check-logic is good enough, but there are two minor "bugs":
    1) even If the array is full, the for cycle will uselessly check all the records
    2) if a the employee number of intEmpNumber is > thanMyEmpArray[index].intEmpNumber the program will show up "Array is full" even if the array isn't full.
    So, I suggest to add more code to make distinction between the two cases:
    for(int index =0; index <3; index++)
    if(MyEmpArray[3] != null ) // check if there is space to add a record
    if (intEmpNumber < MyEmpArray[index].intEmpNumber) //check if the position is right
    addRec(index);
    else
    lblErrorMessage.setText("Array is full");
    break; // exit the for cicle as the array is full
    I don't know what you are programming, but I ask you: "If the new intEmpNumber is < than the intEmpNumber of an already-full-array shouldn't be the new record inserted, discarding the last one?"
    I don't know if addRec works, I'm don't know applets, buttons..:)
    Sorry for my bad english...I hope this post will help you anyway :)

  • Novice needs help: inconsistent recording volume ("flutter")?

    Hello All,
    I'm new to Audition and have been struggling with my recording quality: I'm on a newer dual core Toshiba Qosimio multimedia laptop running Win 7 (64bit) and using a standard desk mic. I read the faq and help files on recording but still remain baffled about this. I'd greatly appreciate some help:
    When recording music in Audition (for example: one strum of a guitar chord), I get a kind of fluttering: I don't hear the whole continous chord's sound. There are subtle 'dropouts' of the sound (like it has inconsistent volume). Now, I'm new at this so I'm probably not using the correct terminology..so I posted a wav file to let you hear:
    http://home.comcast.net/~samiri/director/trash/InconsistentAudio1.wav
    When using this same mic in my older PIV laptop running Win XP, the record quality is fine. Also, when I downloaded Audacity (free audio program) I think I hear the same fluttering..so maybe there is some way I need to set the recording (input) preferences on this machine.
    Thanks for any assistance you can offer.
    [email protected]

    Ah, I had a recent laptop with Connexant Smart Audio, but recently replaced it.
    There is a separate Smart Audio Control Panel that I think is accessible elswhere from the Windows Control Panel. I found it almost totally incomprehensible, but seem to remember that there was a way of switching between two options, one simpler than the other.
    I would also go into the advanced playback settings to see if there are "enhancements" there. Some of these may affect recording.
    As I said before, the only approach with all of this is to find all the various audio contol panels, switch off any effects or enhancements and set all the default sample rates for record and playback to the rate you will be using. Note that the various audio control panels may or may not stay in sync, so it's as well to go round the loop(s) a few times. Do check there is nothing hidden in the "enhancements" area by making sure you scroll down all the options if there are more than just one or two. Note that the Windows audio Control Panel  has to be closed and re-opened before you can trust what it says.
    None of this is the fault of Audition, which just records what is fed to it. It is the fault of Microsoft that there is a broken sample rate converter in Windows 7 and whoever designed the Connexant audio gui does need to be re-educated, I think.
    It would, of course, be very sensible to seek out an external decent usb or similar audio interface.

  • How to count records from 2 tables and show in RDLC Report

    hi all,
    its being a one day searching for the solution but No Luck.
     I have two SQL tables tblstudetail and tblfeereceiptdetail.
    i just want to count records from both tables and show in RDLC report.
    I tried SQl Query Like This:
    select a.session, a.course,
    Count(CASE a.ADstatus WHEN 'OK' THEN 1 ELSE 0 END ) AS Admission,
    Count(CASE s .I_receiptstatus WHEN 'OK' THEN 1 ELSE 0 END) AS Feeprint
    from
    tblstudetail a
    FULL join
    tblfeereceiptdetail s on s.studentID = a.studentID
    where a.session = '2015' AND s.Fsession = '2015' AND a.adcat = 'Regular'
    GROUP BY a.session,a.course
    ORDER by a.course
    The result Show the Same Value in Both columns
    Session    Course      Admission       FeeDetail
    2015          B.A. I               275              275
    2015          B.A. II              307             307
    2015         B.A. III             255            255
    2015          B.Sc. I             110             110
    2015           B.Sc. II           105            105
    2015          B.Sc. III            64               64
    Actully I want to Count How many ADMISSION have been Taken(FROM tblstudetail) and How many FEE RECEIPT have been Print (From tblfeereceiptdetail).
    please guide me for this as soon as possible.
    thanks in advance...

    I am counting 'OK' in both the table columns I.e 'ADstatus' in tblstudetail and 'feereceiptstatus' in tblfeereceiptdetail
    please suggest me

  • Counting records in crosstab report

    I am very new to the reporting world so apologies if this seems so simple.
    I am trying to understand how count records that meet certain criteria and I am at a loss as to how to make it work (Crystal Reports 2008)
    I am setting up a cross tab report where I am want to count records that vwSubscription.status="Active" AND vwSubscription.isDues=True
    I think I should be creating a Formula Field that tests the status and dues record and when they both meet the correct criteria then have the Formula Field in the Summarized field of the Cross Tab Expert...
    make sense? please help

    Yes. You should create a formula like this
    IF vwSubscription.status="Active" AND vwSubscription.isDues=True THEN
    1
    And in Cross tab Create A Sum  of this field under Summary fields.
    If you want this value to be displayed based on some group, cross tab will be a good option, else you can create a sum of this field and place it in Report header to get the total.
    HTH,
    Jyothi

  • How to count records in a page which are in detail section

    Hi
    Is there a option to count records in detail section and so that based on that can apply a formula.

    Hi
    can i place the below two formulas in section experpt ?
    my report is like
    gh#1 
    details-----which contains transactions related to above group for a country
    group footer#1contains line '--
    if for india there are 3 records in the same page there can be 2 or 3 records in detail section. like that a page can contain more than one country. if number of records are more and coming in next page then the whole section should be moved to new page.
    that is my req. can u suggest accordingly.....
    i want to count the number of records in detais which will vary also how can i put formula when they are going to next page?

  • Count consecutive days in array

    Hi,
    I'm looking for an algorithm to count consecutive days in array, but i don't find one.
    for example, if i have this array.
    2009/07/01
    2009/07/02
    2009/07/03
    2009/07/06
    2009/07/08
    2009/07/09
    2009/07/10
    2009/07/11
    The result be
    3
    1
    4
    Anyone have one?
    Thanks for all.

    jverd wrote:
    kajbj wrote:
    It's a fairly specialist algorithm so you are unlikely to find someone to post a solution. By just keeping a reference to the previous date, it is easy to iterate though the list counting consecutive dates.I think the trick to making this algorithm sucessful is to make sure that when you change months your algorithm doesn't set consec_days to 0 Why not?Presumably he's talking about this case:
    7/31
    8/1
    and not this case
    7/1
    8/1
    So he really should have said, "...when you increment month by one, or from 12 to 1, and the day went from the last day of the old month to 1, don't set consec_days to 0"Ok. I would use the Calendar class and SimpleDateFormat. The tricky part would otherwise be to keep track of days per month, and leap year.

  • Error: The sort order specified for distinct count records is incorrect

    When processing a measure group with a distinct count measure in it, i get the following error:
    "The sort order specified for distinct count records is incorrect."
    I have no idea what this means - any ideas?

    I had the same problem and your fix worked.  In more detail, the problematic field was contract_no.  I added a named calculation to the table in the Data Source View with the formula CHECKSUM(contract_no).  Then I created the distinct count measure on that named calculation.  And, lo and behold, the errors disappeared! 
    Thank you to Frank.
     - CindyCindy P Hoskey

  • COUNTING RECORDS AND DETERMINING AVERAGES IN REPORT WRITER

    I HAVE 10 GROUPS. I WANT TO BE ABLE TO COUNT RECORDS AND DETERMINE THE AVERAGE DAYS FOR EACH GROUP. I GET DAYS BY SUBTRACTING THE RECEIVED DATE FROM THE RESULT DATE. I WANT TO DETERMINE THE AVERAGE DAYS AND THE NUMBER OF RECORDS IN THE TOP 10%, THE TOP 20%, THE TOP 30%, THE TOP 40%, THE TOP 50%, THE TOP 60%, THE TOP 70%, THE TOP 80%, THE TOP 90%, AND THE TOP 100%. HOW DO I CODE MY LOOP IN PLSQL TO DO THIS? CAN I DO THIS IN REPORT WRITER?

    I am not sure about the exact thing that you are requiring. but you can get the top 100 and top 20 or top 300 etc. by using the ROWNUM function in sql statement.
    thanks

  • Leaf Count Record

    After backing up my hard drive and booting from my freshly made eDrive, I ran TechTool Pro 6's "Volume Rebuild" and after that ran it showed me the results, as usual. There were a few green items but one red. The "Leaf Count Record" went from 1777 to 625. I tried to find out what a Leaf Count Record is by googling it but only count find things on the error associated with this.
    So my first question is: What is a Leaf Count Record?
    Secondly, is there any problem with my Leaf Count going down, and should i be worried about it?
    Note: i went ahead with the rebuild since all the information i could find on Leaf Count Record is mostly about the Leaf Count going up and not down.

    After backing up my hard drive and booting from my freshly made eDrive, I ran TechTool Pro 6's "Volume Rebuild" and after that ran it showed me the results, as usual. There were a few green items but one red. The "Leaf Count Record" went from 1777 to 625. I tried to find out what a Leaf Count Record is by googling it but only count find things on the error associated with this.
    So my first question is: What is a Leaf Count Record?
    Secondly, is there any problem with my Leaf Count going down, and should i be worried about it?
    Note: i went ahead with the rebuild since all the information i could find on Leaf Count Record is mostly about the Leaf Count going up and not down.

  • Invalid Leaf Count Record

    When I repaired my startup disk with Disk Utility, an invalid leaf count record error was reported. From looking at other posts, it appears that one of the recommended things to do for this is trying to repair the issue with Disk Utility. I tried this using Disk Utility 4.1. I replaced my directory with the rebuilt directory. Unfortunately, when I started back up from my install CD and ran Repair Disk, the invalid leaf count record error was reported again.
    Any advice would be much appreciated... maybe I did something wrong.
    Thanks

    First, I realized that I had the error message wrong. I should have wrote "Invalid Leaf Record Count" originally instead of "Invalid Leaf Count Record". I doubt this makes a difference, but just in case there it is.
    Secondly, I am running 10.3.9 and have been doing so for quite some time. My understanding based on this is that DiskWarrior 4.1 should work. I took your advice and tried running DiskWarrior again. As I did previously, I simply booted from DiskWarrior because the disk I am trying to fix is my startup disk. I rebuilt and replaced the directory with DiskWarrior 4.1 again. As a matter of fact, I ran it multiple times while I had it going. I even ran it under the scavenge mode.
    After doing this, I restarted the computer, ejected the DiskWarrior disc, and put in my install disc that came with my iMac. I booted from this CD and reran "Repair Disk" with Disk Utility. The error stills shows up. One thing to note is that my install disc came with 10.3.5 on it. Could this somehow cause a problem? My understanding is that you should always use an install disc for the major OS version you are running to run the "Repair Disk" function of Disk Utility. For example use an install disc for 10.3 if you are trying to repair a disk running 10.3.x or use an install disc for 10.4 if you are trying to repair a disk running 10.4.x.
    Prior to ever running DiskWarrior, I used the fsck command from single-user mode. Interestingly, the error did not show up here. I thought the "Repair Disk" function with Disk Utility was similar to this command, but maybe there is enough variation to cause the difference. Do you guys have any idea, which one I should trust?
    Let me know if any of this is incorrect. Any other suggestions regarding this error would be welcomed. I don't really understand what the error itself means. For now, I guess I will just leave it since I don't really know what else to do. Maybe in the future it will get worse and DiskWarrior will recognize it... I know that's asking for a problem!

  • Help with records.

    Im nw to java and I need help with records. Can you please tell me how to make a record called car, store the make and model and display them like the structure chart below( yes its a structure chart).
    ================ main =========
    =============== / === \ ========
    ============= / ======= \ ======
    =========== / ========== \ =====
    ========= get car ======= display =
    ========= record ===============
    ======== / ===== \ ==============
    ======= / ======= \ =============
    ====== / ========= \ ============
    === get car ======= get car ========
    === make ======== model ========
    ==============================

    welcome to world of java...
    here is a skeleton structure of what you want..
    class myCar{
    public static void main(String args[]){
    myCar car = new myCar();
    car.displayCar();
    System.out.println(getCarRecord());
    void displayCar(){
    // display your car image here
    String getCarMake(){
    // returns String containing make of car
    String getCarModel(){
    // returns String containing model of car
    String getCarRecord(){
    return getCarMake() + " " +getCarMake();
    maybe this helps

Maybe you are looking for