Counting number of inputs in a loop

I'm trying to find a way to count how many times a number has been inputted in a loop but unable to find a calculation to find the answer,
can anyone help??
I'm new to Java.

Stinkin' crossposter!
http://forum.java.sun.com/thread.jspa?threadID=605663

Similar Messages

  • How do I count the number of inputs in a loop?

    I'm trying to find a way to count how many times a number has been inputted in a loop but unable to find a calculation to find the answer,
    can anyone help??
    Please take me step by step on how to solve this problem as I'm new to Java.

    Today's spam day, I guess. Listen, you and the paint-squares-guy, too:
    STOP TO FUCKING SPAM THIS FORUM WITH YOUR QUESTION. ONCE IS ENOUGH. TWICE IS ANNOYING. TEN TIMES IS LIKELY TO MAKE ME COMPLAIN TO SUN AND HAVE YOUR NEWBIE ASSES KICKED!

  • How to count Number of Input files onTarget Location?

    Hi Experts,
    I want to identify number of Input files available in Directory of Target system. Input file format is Input*.txt
    Once if I have this Count then based on that I can apply further logic in SAP R/3 coding.
    Please suggest me for the same.
    Regards,

    >
    Jagesh Lakdawala wrote:
    > My requirement is to read the Input Text file available on a given Location.Filename format is Input*.txt because Number of Input file is not fixed. All the Input file data needs to be available at the same time in R/3 coding (Internal table). i.e in a single XML message payload.
    > My question is in this BPM how do i know the LOOP Counter?? because LOOP should run depending on the Number of Input files available with the format Input*.txt.
    >
    > Please suggest.
    >
    > Regards,
    > Jagesh
    so say at one instance there are 7 files and XI picks them up, your BPM collects it and when you send it to R3 you need to know how many files have been processed?
    Well if this is the case, modify your BPM to accommodate collect pattern based on time. So fix a time period basically a time out say an hour. So the BPM will run for an hour after it receives the first file in and if within an hour say 7 files have come in, once the time out kicks in the BPM will exit. In you mapping of N:1 inside the bpm you can write a UDF which will count the occurrance of the root node of the source (a mandatory node of the source) and populate it to any field in the target tht you want to use.
    Is this what you are looking for?

  • Counting number of inputs

    i have an input variable, aquired by using bitin.vi, and have translated into an interger. - ie 1 for input r 0 for no input. is there a way of counting the number of inputs in a given time?
    im building a heart rate monitor, and need the inputs of pulses to be counted to calculate the bpm.
    any help on getting the value to add up in 10 seconds would be greatfully appreciated.

    Why make it so complicated?  This is much simpler:
    I am not familiar with "bitin.vi".  Are your pulses coming in one at a time?  In an array?  In a waveform?  If they are coming in one at a time, you can use a case structure and a shift register similar to the picture above.  If they are in an array, and the only values are 0 and 1, you can just sum the array over the time range you are interested in, and that will give you the number of pulses (look on the Numeric palette).  If you have a waveform, you can get the Y array from the waveform components and sum that array.  If you want all the pulses in the waveform, leave out the Get Waveform Subset part.
    Message Edited by jasonhill on 04-26-2006 12:56 PM
    Attachments:
    improved count.PNG ‏5 KB
    improved count2.PNG ‏4 KB

  • Looping assistance (counting number of characters in a variable)

    Good morning, all! I was wondering if anybody could take a look at this small, easy project I was working on today. I've searched the net for an answer and while it was useful and I learned a few things, nothing is really working. The code is pretty self explanatory, infact, I'm embarrassed I do not know how to do this, because I'm sure I know. Basically, counting the length of the variable is not working. The output is supposed to be as many times as the input is long in characters (I hope that makes sense!) Anyways, if you could take a look and tell me if you see anyway I could fix this, I would appreciate it.
    import java.util.*;
    import javax.swing.JOptionPane;/**
    * @author Willaim
    public class Loop {
         * @param args
         public static void main(String[] args) {
              String loopInput;
              int count;
              loopInput = JOptionPane.showInputDialog("Please enter a word for the loop demo: ");
              while(count < loopInput.length){
                   System.out.println("" +loopInput);
                   count = count + 1;
              for (count = -1; count < loopInput.length; ++count){
                        System.out.println(loopInput);
              do {System.out.println("loopInput");
                   count++;
                   }while (count < loopInput.length);
         }

    1) to get length from a String, you must use a method and all methods end in parenthesis (arrays are different in that you are getting the length field, and this doesn't require parenthesis.
    2) You probably don't want to use this "count" variable. You will probably be better with a for loop here since the number of iterations through the loop is defined in advance.
    Also, when posting your code, please use code tags so that your code will retain its formatting and be readable. To do this, either use the "code" button at the top of the forum Message editor or place the tag &#91;code] at the top of your block of code and the tag &#91;/code] at the bottom, like so:
    &#91;code]
      // your code block goes here.
      // note the differences between the tag at the top vs the bottom.
    &#91;/code]or
    {&#99;ode}
      // your code block goes here.
      // note here that the tags are the same.
    {&#99;ode}

  • How to count number of edges using PXIe-6363 Counters

    Hello,
    I am trying to count number of edges in a test signal in a 50 ms duration. I am using PXIe-6363 card and connecting the test signal to CTR 0 SRC (PFI 8). Is it a correct connection? What else do I need hardware-wise to make a correct set up for this application?
    Thanks
    Jeet
    Solved!
    Go to Solution.

    Hi Jeet,
    When you say interrupt signal, do you mean a pulse that will pause your counter task? If that is the case, and you want to pause your task with a digital pulse, you need to use the DAQmx Trigger Property Node and set that to Pause, Trigger Type. As you said, you can connect that signal coming from the chip to any PFI line and then set that line as the source of the property node.
    There is an example that you can use that does exactly what I just described. This example is called Count Digital Events-Pause Trig.vi, and you can find it by going to Help>Find Examples..., then on the NI Example Finder window go to the Browse tab and navigate in the folders to Hardware Input and Outpout\DAQmx\Counter Measurements\Count Digital Events.
    Regards.
    Jorge
    Applications Engineer
    National Instruments
    Certified LabVIEW Associate Developer (CLAD)

  • How to count number of raw & put result top of page?

    I try to count number of table raw it work fine  but when I wont to put result top of page it dose not work
    only count one table raw
    REPORT  ZTEST.
    DATA: it_sflight TYPE TABLE OF Sflight WITH HEADER LINE  .
    DATA counter TYPE i VALUE 0.
    start-of-SELECTION.
    SELECT-OPTIONS: carID for it_sflight-carrid.
    SELECT-OPTIONS: connID for it_sflight-connid.
    SELECT * FROM Sflight INTO CORRESPONDING FIELDS OF TABLE it_sflight 
    WHERE carrid IN carID and connID IN connid.
    loop at it_sflight .
      counter = counter + 1 .
      write: /5 it_sflight-carrid,sy-vline,
               30 it_sflight-connid,sy-vline,
                  45 it_sflight-fldate,sy-vline,
                    60 it_sflight-currency,sy-vline.
    ULINE.
    endloop.
    end-of-SELECTION.
    TOP-OF-PAGE .
    *START-OF-SELECTION.
    WRITE:  'Total Rows : ', counter.
    ULINE.
    WRITE: /5 'Carrid',sy-vline,
            30 'Connid',sy-vline,
            45 'Fldate',sy-vline,
              60 'Currency',sy-vline.
    ULINE.
    how can I solve this problem ?

    Hi
    Instead of using counter in a loop use describe statement.
    Describe it_sflight.
    the no of rows will get populated in the system variable sy-tfill.
    DATA: it_sflight TYPE TABLE OF Sflight WITH HEADER LINE  .
    DATA counter TYPE i VALUE 0.
    start-of-SELECTION.
    SELECT-OPTIONS: carID for it_sflight-carrid.
    SELECT-OPTIONS: connID for it_sflight-connid.
    SELECT * FROM Sflight INTO CORRESPONDING FIELDS OF TABLE it_sflight
    WHERE carrid IN carID and connID IN connid.
    DESCRIBE TABLE it_sflight.
    loop at it_sflight .
      counter = counter + 1 .
      write: /5 it_sflight-carrid,sy-vline,
               30 it_sflight-connid,sy-vline,
                  45 it_sflight-fldate,sy-vline,
                    60 it_sflight-currency,sy-vline.
    ULINE.
    endloop.
    end-of-SELECTION.
    TOP-OF-PAGE .
    *START-OF-SELECTION.
    WRITE:  'Total Rows : ', sy-tfill.
    ULINE.
    WRITE: /5 'Carrid',sy-vline,
            30 'Connid',sy-vline,
            45 'Fldate',sy-vline,
              60 'Currency',sy-vline.
    ULINE.
    Thanks
    Rahul jain
    Edited by: Rahuljn on Feb 2, 2011 10:58 AM

  • Count number of records in a internal table

    hi
    i want to count number of records in internal table
    pls let me know how to count the number of records in a internal table.
    regards
    Arora

    hi
    one way is
    data field type i.
    Decribe table itab lines field.
    write: / field.
    displays the no of records in tha internal table
    or if u want to write logic.
    data:
      w_count type i.
    loop at itab.
    w_count = w_count + 1.
    endloop.
    write: / w_count.
    displays the no of records.
    reward points if useful.

  • Need help to count number of rows and display in file

    Hello,
    my scenario is IDOC to File......i am using XSLT mapping and using FCC parameters to convert the flat file.
    now new requirement is i need to count number of rows and add count value last of the file.
    Please let me know how to do it,
    thanks in advance for your help.
    Regards,
    Chinna

    thanks again, one more Q.
    in XSLT mapping i have written for loop for complete structure.
    example : <Details>
                         <node1>
                         <node2>
                   </details>
    in XSLT mapping
                         <xsl:for-each select="ZMATMAS_01/IDOC/E1MARAM">
         <Details>
         </Details>
         </xsl:for-each>
    if i add the field at target side....then i will come under details node and it will be repeated.
    how to declare in XSLT mapping.

  • To count number of records in an internal table for a condition

    Hello All,
            I want to count number of records in an internal table for a condition.
    For e.g. -- I have one internal table IT which having fields F1, F2, F3, F4, F5.
                     Now, I want number of records in itnternal table IT where F1 = 'ABC'.
    Is it possible to do..?? If yes, then how.??
    Thanks in advance...!!
    Regards,
    Poonam.

    Hi,
    If you mean an internal table, there are a few ways to do this.
    1 One would be to loop over the table with a WHERE clause and increment a counter.
    data: lv_counter type i.
    clear lv_counter.
    loop at itab where fld1 = 'ABC'.
    lv_counter = lv_counter + 1.
    endloop.
    lv_counter now has the number of rows per the condiction.
    2  Well, you may want to try this as well, and compare to the LOOP way. Not sure what kind of overhead you may get doing this way. Here ITAB is our main internal table, and ITAB_TMP is a copy of it. Again I think there may be some overhead in doing the copy. Next, delete out all records which are the reverse of your condition. Then whatever is left is the rows that you want to count. Then simply do a LINES operator on the internal table, passing the number of lines to LV_COUNT.
    data: itab type table of ttab.
    data: itab_tmp type table of ttab.
    itab_tmp[] = itab[].
    delete table itab_tmp where fld1  'ABC'.
    lv_count = lines( itab_tmp ).
    Thanks & Regards,
    ShreeMohan

  • How to count number of sales orders generated in a month in SAP SD

    Hi SD Gurus,
    I have a very strange query from client. I have to count the number of sales order created in a month for a z report. For example 30 in Jan, 25 in Feb etc. Could anyone suggest me How to count number of sales orders generated in a month in SAP SD.
    Regards
    Vinod Kumar

    Hi,
    Goto the T.Code "SE16" or "SE16n" or "SE11".
    Enter the table name as VBAK
    Enter the created on date as the starting date of the period and to date as the end date.
    Enter.
    Click on "Number of Entries".It will tell you the number of entries created in a particular period.
    If you want a report,goto the T.Code "VA05n".
    Regards,
    Krishna.

  • How to Count Number of completed line items in past 6 months / 12 months ?

    How to Count Number of completed line items in past 6 months / 12 months ?
    Hi,
    I am trying to count "Number of Completed Line Items in Purchase Order Document" for my Key Figure ZPO_CNT.
    Purchase Order document = ZEBELN
    Line Item = ZEBELP.
    I need to find and count if the Line Item has been received in the past 6 months from today and similarly in the past 12 months.
    I have "Delivery Completed" field, ELIKZ.
    So, based on this would I be able to calculate it in Query Designer?
    If so, Please let me know how

    Hello Deva
    If youe want to calculate the completed line item for last 6 or 12 month then i think u will be displaying the query data for these montrhs...create a customer exit to give you date range and restric it in filter area....
    Now Choose any of the below option
    1. I would suggest to implement an additional key figure "counter" in cube and fill values with one for which delivery is completed.
    Now use calculated key figure in Query Designer based on logic
    IF counter = 1 THEN counter ELSE 0
    OR
    2. create a formula variable based on ELIKZ and use replacement path variable, it will display you no. of docs for which delivery is completed....
    Award points if it solves your problem
    Revert back in case of further assistance...
    Thanks
    Tripple k

  • How to Count number of words in a file....

    Hi Experts,
    I have uploaded the text file, from the application server, like this: 
    call function 'GUI_UPLOAD'
      exporting
        filename = LV_ip_FILENAME
      tables
        data_tab = LT_FILETABLE.
    The text file contains some number character words....  like "sap labs india..... "
    Now, I wanted to count number of words in an internal table  LT_FILETABLE....  can anybody help me?

    Hi,
    Special Characters in Regular Expressions
    The following tables summarize the special characters in regular expressions:
    Escape character
    Special character Meaning
    Escape character for special characters
    Special character for single character strings
    Special character Meaning
    . Placeholder for any single character
    C Placeholder for any single character
    d Placeholder for any single digit
    D Placeholder for any character other than a digit
    l Placeholder for any lower-case letter
    L Placeholder for any character other than a lower-case letter
    s Placeholder for a blank character
    S Placeholder for any character other than a blank character
    u Placeholder for any upper-case letter
    U Placeholder for any character other than an upper-case letter
    w Placeholder for any alphanumeric character including _
    W Placeholder for any non-alphanumeric character except for _
    [ ] Definition of a value set for single characters
    [^ ] Negation of a value set for single characters
    [ - ] Definition of a range in a value set for single characters
    [ [:alnum:] ] Description of all alphanumeric characters in a value set
    [ [:alpha:] ] Description of all letters in a value set
    [ [:blank:] ] Description for blank characters and horizontal tabulators in a value set
    [ [:cntrl:] ] Description of all control characters in a value set
    [ [:digit:] ] Description of all digits in a value set
    [ [:graph:] ] Description of all graphic special characters in a value set
    [ [:lower:] ] Description of all lower-case letters in a value set
    [ [:print:] ] Description of all displayable characters in a value set
    [ [:punct:] ] Description of all punctuation characters in a value set
    [ [:space:] ] Description of all blank characters, tabulators, and carriage feeds in a value set
    [ [:unicode:] ] Description of all Unicode characters in a value set with a code larger than 255
    [ [:upper:] ] Description of all upper-case letters in a value set
    [ [:word:] ] Description of all alphanumeric characters in a value set, including _
    [ [:xdigit:] ] Description of all hexadecimal digits in a value set
    a f
          v Diverse platform-specific control characters
    [..] Reserved for later enhancements
    [==] Reserved for later enhancements
    u2192 More
    Special characters for character string patterns
    Special character Meaning
    Concatenation of n single characters
    {n,m} Concatenation of at least n and a maximum of m single characters
    {n,m}? Reserved for later enhancements
    ? One or no single characters
    Concatenation of any number of single characters including 'no characters'
    *? Reserved for later enhancements
    + Concatenation of any number of single characters excluding 'no characters'
    +? Reserved for later enhancements
    | Linking of two alternative expressions
    ( ) Definition of subgroups with registration
    (?: ) Definition of subgroups without registration
    1, 2, 3 ... Placeholder for the register of subgroups
    Q ... E Definition of a string of literal characters
    (? ... ) Reserved for later enhancements
    for more details please refer the following,
    [http://help.sap.com/abapdocu_70/en/ABENREGEX_SYNTAX_SIGNS.htm]
    [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/902ce392-dfce-2d10-4ba9-b4f777843182?QuickLink=index&overridelayout=true]
    Thanks,
    Renuka S.

  • How to count number of ones in table

    Hello,
     i created one table 16x32 each cell is updating 1 byte of data,how to count number of one in all cell,and is it right way to calculate check sum??
    thank you

    The simplest way is to call GetTableCellRangeValues with VAL_ENTIRE_TABLE as the range, next summing array elements.
    But I don't understand your comment on checksum, so this may not be the more correct method for your actual needs: can you explain what do you mean?
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • URGENT HELP NEEDED: counting number of particles from image

    this image on the left is showing particles
    hello i want to create a small VI that can count number of particles from a image that i load up. please see the attached image of particles and the VI printshot.
    I have used the tutorial "counting number of particles" but still the above VI does not work. it shows the number of particles = 1.. I do not know why it is doing so??
    I am not an expert in Labview so please can someone tell me where the problem is. sorry i could not attach the VI file itself but i have given an image of it..
    after anyone has solved this problem, i have to create a live system that will get live images from the camera - four frames every sec and the above VI has to count the
    number of particles for each frame and output to the user?? is this possible can anyone do it for me???
    p.s. in the above VI i read the image from file and count the number of particles. i do not do it to the binary image becuase the binary image is only a black screen
    when i run it
    thankyou

    Hi Farhan,
    Vision Assistant would be the best option to create some steps which you can then export to LabVIEW. You should try using the IMAQ Find Circles.vi. The attached image helps you find the number of circles of an image acquired from a camera. I have used the IMAQdx VIs in this example.
    Adnan Zafar
    Certified LabVIEW Architect
    Coleman Technologies
    Attachments:
    vision.vi ‏59 KB

Maybe you are looking for

  • Performance issues since upgrade

    I am on a late 2011 MacBook Pro and am having severs performance issues since upgrading to Mavericks. I fear my issues may be related to company installed anti-virus (which I cannot remove), but I was hoping someone could look over my EtreCheck for o

  • Why can't I access the Google site? None of the suggested remedies worked.

    I signed in to my Google calendar account and got an error message saying there was a problem with my cookies and I should clear my cache. If that didn't fix the problem, I should disable cookies. I followed these instructions and the problem was not

  • Regarding dep

    hello, want to ask u regarding asset that i had a cut over of an asset which had acquisition value , ord.dep. amount. tell me that while creating asset master from as91 ,i put the ord.dep amt in take over value page in ord. dep. post value field and

  • How to block a person in your contact call??, how to block a person in your contact call??

    i m receiving anknown call and want to block some of my friends that they shouldnt call me so i just wanna know is there any app for blocking a number or somehow

  • SMTP Send Mail - too many authenticated connection...

    Using Outlook on a MAC, and within this last week I have started to get this error when sending mail. I have read all the forum posts and help documents on this issue and ensured that my settings are as described and yet I am still having this proble