Count number of matches.

I am adding some code on to an existing script. What i am trying to do is match the files against files located as a back up on the server. Verifying that they are all there. I have been able to match them but now I want to count how many matches i have. This should be easy but I am confused.
for ( i = 0; i < count; i++ ) {
         file = doc.visibleThumbnails[i].spec.toSource();
         f =doc.visibleThumbnails[i].name.slice(0,10);
        pageImage =doc.visibleThumbnails[i].name;
        extractName=boot[i].name;
        var myMatch=0;
    for (var j = 0; j < boot.length; j++) {
        if((pageImage.match ( boot[j].name))){myMatch=myMatch++; }        
    alert(myMatch);
I thought I could just asign ++ to a var but its not working.

I ended up not counting really but pushing each object as a string. Then counting the objects in the array by using length.
for (var j = 0; j < boot.length; j++) {
if(boot[j].type!="????"){ myArchive.push(boot[j].name);}
for ( i = 0; i < count; i++ ) {
pageImage =doc.visibleThumbnails[i].name;
if((pageImage.match ( boot[j].name))){  myMatches.push(boot[j].name);}

Similar Messages

  • Column count doesn't match value count at row 1, unknown number of columns

    Hi,
    I am making a program to read data from excel files as the above and store them in tables. I have managed to read all the data from excel files as a string and store them in a table.
    ID Name Salary
    50 christine 2349000
    43 paulina 1245874
    54 laura 4587894
    23 efi 3456457
    43 jim 4512878
    But in my project I have several other files that have same cell that are blank as the above example
    ID Name Salary
    50 christine 2349000
    43 paulina
    laura 4587894
    23 3456457
    43 jim 4512878
    and when i ran the same program i get this exception :
    SQLException: Column count doesn't match value count at row 1
    SQLState: 21S01
    VendorError: 1136The code for creating the table and inserting the values is above:
    private static String getCreateTable(Connection con, String tablename,
                        LinkedHashMap<String, Integer> tableFields) {
                   Iterator iter = tableFields.keySet().iterator();
                   Iterator cells = tableFields.keySet().iterator();
                   String str = "";
                   String[] allFields = new String[tableFields.size()];
                   int i = 0;
                   while (iter.hasNext()) {
                        String fieldName = (String) iter.next();
                        Integer fieldType = (Integer) tableFields.get(fieldName);
                        switch (fieldType) {
                        case Cell.CELL_TYPE_NUMERIC:
                             str = fieldName + " INTEGER";
                             break;
                        case Cell.CELL_TYPE_STRING:
                             str = fieldName + " VARCHAR(255)";
                             break;
                        case Cell.CELL_TYPE_BOOLEAN:
                             str = fieldName + " INTEGER";
                             break;
                        default:
                             str = "";
                             break;
                        allFields[i++] = str;
                   try {
                        Statement stmt = con.createStatement();
                        try {
                             String all = org.apache.commons.lang3.StringUtils.join(
                                       allFields, ",");
                             String createTableStr = "CREATE TABLE IF NOT EXISTS "
                                       + tablename + " ( " + all + ")";
                             System.out.println("Create a new table in the database");
                             stmt.executeUpdate(createTableStr);
                        } catch (SQLException e) {
                             System.out.println("SQLException: " + e.getMessage());
                             System.out.println("SQLState:     " + e.getSQLState());
                             System.out.println("VendorError:  " + e.getErrorCode());
                   } catch (Exception e)
                        System.out.println( ((SQLException) e).getSQLState() );
                        System.out.println( e.getMessage() );
                        e.printStackTrace();
                   return str;
              private static void fillTable(Connection con, String fieldname,
                        LinkedHashMap[] tableData) {
                   for (int row = 0; row < tableData.length; row++) {
                        LinkedHashMap<String, Integer> rowData = tableData[row];
                        Iterator iter = rowData.entrySet().iterator();
                        String str;
                        String[] tousFields = new String[rowData.size()];
                        int i = 0;
                        while (iter.hasNext()) {
                             Map.Entry pairs = (Map.Entry) iter.next();
                             Integer fieldType = (Integer) pairs.getValue();
                             String fieldValue = (String) pairs.getKey();
                             switch (fieldType) {
                             case Cell.CELL_TYPE_NUMERIC:
                                  str = fieldValue;
                                  break;
                             case Cell.CELL_TYPE_STRING:
                                  str = "\'" + fieldValue + "\'";
                                  break;
                             case Cell.CELL_TYPE_BOOLEAN:
                                  str = fieldValue;
                                  break;
                             default:
                                  str = "";
                                  break;
                             tousFields[i++] = str;
                        try {
                             Statement stmt = con.createStatement();
                             String all = org.apache.commons.lang3.StringUtils.join(
                                       tousFields, ",");
                             String sql = "INSERT INTO " + fieldname + " VALUES (" + all
                                       + ")";
                             stmt.executeUpdate(sql);
                             System.out.println("Fill table...");
                        } catch (SQLException e) {
                             System.out.println("SQLException: " + e.getMessage());
                             System.out.println("SQLState: " + e.getSQLState());
                             System.out.println("VendorError: " + e.getErrorCode());
                   }To be more specific the error it in the second row where i have only ID and Name in my excel file and only these i want to store. The third row has only Name and Salary and no ID. How i would be able to store only the values that i have and leave blank in the second row the Salary and in the third row the ID? Is there a way for my program to skip the blanks as empty value?
    Edited by: 998913 on May 9, 2013 1:01 AM

    In an unrelated observation, it appears you are creating new database tables to hold each document. I don't think this is a good idea. Your database tables should be created using the database's utility program and not programmatically. The database schema should hardly ever change once the project is complete.
    As a design approach: One database table can hold your document names, versions, and date they were uploaded. Another table will hold the column names and data types. Another table can hold the data (type for all data = String). This way, you can join the three tables to retrieve a document. Your design will only consists of those three tables no matter how many unique documents you have. You probably should seek the advice of a DBA or experienced Java developer on exactly how structure those tables. My design is a rough layout.

  • What is a best practice for counting number of payments in Payroll Run?

    I'm trying to get a feel for what people are using as a means for counting number of payments being created during a payroll run.  I would like to get a total number of checks, direct deposits, wires and zero net checks.  My initial thought is to use the Pre-DME number "Selected and Evaluated Persons".  This number seems to always match the number of persons "Selected" and "Evaluated" in posting to FI/CO.
    Since many companies are restricting use of SE16 and access to many of the BT tables is locked down, I would like to use something that the end user has access to and can easily use.  I don't believe the spools from RFFOUS_C and T are appropriate since it would have overflow pages (2 page REM Statements) in that number and thus would not be an accurate reflection of total number of payments.
    I would appreciate your insight and thoughts on this topic.
    Thanks!

    Hello Jennie,
    This is what we do every payroll:
    1. After running live payroll and before exiting our users run wage type reporter /559 to get the payroll net pay. They also run Postings to FICO simulation run to check payroll net pay GL account. This match all the time. So this is the first pass.
    2. They finish all subsequent activities in PRD run upto RFFOUS_T.
    3. We have developed a custom report which almost looks like REGUH which gives the net pay details by every payment method and amount to be deposited or paid. We match this report from the output we received from step 1.
    4. Run postings to FICO live and check the payroll net pay GL account for final validation.
    The steps might sound tedious but of a great use.
    Arti

  • How to see number of matching results in the find bar?

    Hi, can I configure Firefox to include the number of matching results on the page in the find bar? It's one of the things I appreciate in other browsers (helps give context / get a feel for relevance / make quick decisions)
    Or is there a lightweight add-on to do the same?
    Thanks :)

    I haven't tried this, but the [https://addons.mozilla.org/en-us/firefox/addon/findbar-tweak/ FindBar Tweak] extension advertises "Total hits and current hit counter in the findbar".

  • Counting number of people by image capturing

    Hi!
    i am an university student, recently i have received a image processing research project. my tutor ask me to count number of people by capturing the image. It is a huge task for me. Because human contour variation is huge, and difficult to have standard shape. i still have no idea in this field. Does anybody has ideas or resources for this??
    Pls help!!!
    Thanx alot

    Hi iamcoconut,
    You can use the pattern matching functions in IMAQ Vision to search for complex images, such as a set of eyes, etc. However, if you are going to have images of people from different angles, the best method to find the people is to use a Static Background type analysis. This analysis takes an image of the background without people in it and then acquires an image of the same background with people in it. Performing a simple subtract and then separating the images, removing particles, etc. isolates your people so that they may be "counted."
    Matthew Smith
    Applications Engineering
    National Instruments

  • 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 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

  • 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

  • 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.

  • How to count number of rows in table

    can I get number of row in table except Count(*) in pl/sql
    is there any other way

    Also posted and answered here
    how to count number of rows in table
    count(*) will be the fastest way. It is only slow if the table has a vast number of rows, in which case why do you need to know the tables has 73552436467721 rows and not 73552436467737 rows. It doesn't seem to be much use. Either that or you are counting them a lot, which again seems rather pointless.

Maybe you are looking for

  • MCRE report

    Hi Experts, I met a problem with report MCRE. When I use the MCRE to generate a report, the Qty withdrawn listed here for a specific material in a specific production order is different from the Qty withdrawn displayed in the production order (CO03).

  • Displaying image in email

    Hi, I developing a test application, where the flowchart is displayed and followed by some answer part. So, I wanted to display the flowchart in the email (not attaching), but displaying in some specific region. How can I do this? Please help!

  • Other solution during stock shortage when posting several invoice item?

    Hi Experts, Referring to Note 362037, posting an invoice with price variance to a material with moving average price , the stock quantity coverage is less than the posting quantity. The standard SAP system perform the stock shortage exam considering

  • CS5 problems importing images into HDR

    I am trying to open 8 raw files in HDR and I get an error message, "could not import the clipboard because the result would be to big.  I went into Photoshop/preferences/performance and up the the ideal range memory to the recommended max 5206.  I ha

  • Buzzing in my Megaworks THX650

    Hello all! Recently I have noticed that my sound system has developed a buzzing sound, and have no idea when it happened. I have not moved or changed my setup in years, so am fairly certain that it is something internal. Here is what I have tried: -M