How do I auto-calculate the number of appearances of a particular value in multiple fields?

Hi folks!  Some assistance with this matter would be greatly appreciated.
I have a form where I need to have calculated the number of appearances of certain values in a dropdown list.  The total number of each would then be calculated and displayed in separate fields.
Here's the exact situation:
I have 22 dropdown fields labeled Code1 through Code22.  The export value for each of these can be any one of 21 different values: 1; 2a; 2b; 3; 4; 5; 6a; 6b; 6c; 6d; 6e; 7; 8; 9a; 9b; 10a; 10b; 10c; 10d; 10e or 10f.
The idea then is to have the total number of each value appear in a separate field.
E.g., the form user makes a "10a" selection in any three of the Code1 through Code22 fields; the number "3" will then appear in a separate auto-calculated field reserved for total number of "10a" values.  If the user makes two "9b" selections, the number "2" would appear in a separate field reserved to show the total number of "9b" values.
I hope that's clear.
Thank you, all, for your help!

I would use a doc-level function to do it, and provide the value to look for as a parameter. So the function will look like this:
function countValues(s) {
    var total = 0;
    for (var i=1; i<=22; i++) {
        var f = this.getField("Code"+i);
        if (f.value==s)
            total++;
    return total;
Then as the custom calculation script of the text fields you enter something like this:
event.value = countValues("10a");
Or like this:
event.value = countValues("9b");
etc.

Similar Messages

  • How to calculate the number of user connections in a report?

    Hi,
    I would like to have a report which automatically calculate the number of connections per user.
    Thanks for your answer.
    Regards

    Hi,
    What do you mean by number of connections? Do you mean how many times each user has run a specific report?
    Thanks

  • How to calculate the number of days worked for a given period

    I need to calculate the number of days worked by contractor employees for a time period to be entered by a user. I am building a query on an infoset which contains employee information including contract start date and contract end date for the employee.
    Ideally I'd like the user to enter the time period which should be reported on e.g. 01.08.2009 to 31.08.2009
    The report should then identify all the contractor employees which were working during this period and to work out how many days they worked during this period. Obviously the contract start and end dates could fall both inside and outside the reporting period.
    Can this be done and if so, do you have any suggestions as to how to do it?
    Thanks.

    hi
    So here you will first have to load the master data table employee in one internal table and read this table with the variables entries.
    Your code in the reporting exit should look like that.
    bye
    data : wa_employee type /bi0/pemployee.
    When 'ZDATE1'
    if i_step = 2.
    LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZDATE2'.
    clear l_s_range.
    clear wa_employee
    1- select the entries from table employees
    select single employee dateto datefrom
    from /bi0/pemployee
    into corresponding fields of wa_employee
    where dateto le loc_var_range-low
    and datefrom ge loc_var_range-high.
    if sy-subrc eq 0.
    CALL FUNCTION 'FIMA_DAYS_BETWEEN_TWO_DATES'
       EXPORTING
           i_datum_von  = wa_employee-datefrom
           i_kz_ult_von = 'X'
           i_datum_bis  = wa_employee-dateto
           i_kz_ult_bis = 'X'
           i_szbmeth    = '1'
       IMPORTING
          e_tage       = no_days.
           l_s_range-low  = no_days.
           l_s_range-sign = 'I'.
           l_s_range-opt  = 'EQ'.
          APPEND l_s_range TO e_t_range.
              ENDIF.
            ENDIF.
    endloop.
    ENDIF.
    Boujema

  • How to calculate the number of sent/received emails of a certain domain

    Thank you for what you have helped me with!
    How to calculate the number of sent/received emails of a certain domain in a certain period? It is Messaging Server 5.2, Directory Server 4.2. Is there a log option for this?
    Thank you.

    Not sure where you find, "LOG_MESSSAGE_ADD". I don't actually find this option in the documentation.
    The domains that mails are coming from and being sent to are certainly logged in the normal mail.log, so why mess with additional logging options? If you're talking about "LOG_CONNECTION", I actually see no additional data that is useful to you.
    If you decide to change the option.dat, you do indeed need to
    imsimta cnbuild (note, it's not cnrebuild)
    imsimta restart
    If I were facing the same issue, I'd be looking at the log parsing perl script, and simply modifying it to do what I wanted.

  • How to calculate the number of vowels from a txt file. Pls give me a hand!!

    Guys! How do i calculate the number of vowels from a txt file? I have to create a program to count the number of words, sentence, and vowels. So far I had managed to count the number of words. Now I need help on counting sentence and vowels! Pls give me a hand guys!

    I first have to read from the file not the string.I
    know how to read from a file. Now the problem ishow
    to compare a character from a txt file!You fail to understand, that you have read the data
    from the file into a string. Now loop over all
    characters in the string. Forget about the file.
    KajOr forget the scanners just as others have told you. Just read the file character by character using a FileReader.
    Kaj

  • How to calculate the number of operations in Undo/Redo stack?

    How to calculate the number of operations in Undo/Redo stack?
    I tried to override UndoManager.pushUndo method and increment "operationsCounter" there, but pushUndo is called each time I make a change in text.
    Another idea was to override EditManager.finalizeDo and use "operationsCounter" there, but finalizeDo is private...
    Do you have any idea?

    Hi Richard,
    Thanks for the reply. I suggested that existed the more simple way to implement this

  • I wanted to know how do you calculate the number of days between two dates

    i wanted to know how do you calculate the number of days between two dates in java ? i get both the dates from the database. i guess there are many issues like leap year and Febuary having diff no of months ..etc.

    thanks..
    I solve my problem as
    public class MyExample {
        public static void main(String a[]) {
            String stdate = "2009-03-01";
            java.sql.Date currentDate = new java.sql.Date(System.currentTimeMillis());
            java.sql.Date preDate = java.sql.Date.valueOf(stdate);
            System.out.println(currentDate);
            System.out.println(preDate);
    //        int dateCom = preDate.compareTo(currentDate);
    //        System.out.println(dateCom);
            long diff = currentDate.getTime() - preDate.getTime();
            int days = (int) Math.floor(diff / (24 * 60 * 60 * 1000));
             System.out.println(days);
    }

  • How to calculate the number of months between two string as yyyymm

    Dear all,
    I have two month string like yyyymm e.g. 201003 -- 201105. Now I want to calculate the number of months bertween these two month string? How can I do that? Thanks.

    888099 wrote:
    Hi,
    Hope this will help :
         public static void main(String[] args) {
              Calendar cal1 = new GregorianCalendar(2010, 02, 01);
              Calendar cal2 = new GregorianCalendar(2011, 04, 01);
              int years = cal1.get(Calendar.YEAR) - cal2.get(Calendar.YEAR);
              int months = cal1.get(Calendar.MONTH) - cal2.get(Calendar.MONTH);
              System.out.println("number of months : "+Math.abs(years*12 + months));
         }Or with only Strings :
         public static void main(String[] args) {
              String s1 = "201002";
              String s2 = "201104";
              int years = Integer.valueOf(s1.substring(0,4)) - Integer.valueOf(s2.substring(0,4));
              int months = Integer.valueOf(s1.substring(4)) - Integer.valueOf(s2.substring(4));
              System.out.println("number of month : "+Math.abs(years*12 + months));
         }Edited by: 888099 on 28 sept. 2011 05:49Full code solutions will not help the OP, he will be back here with a different Date question. Posters here try to nudge the OP to figure out the solution himself.

  • How can we calculate the number of pages in any given web site?

    1.     Calculate the number of Pages (html pages) on our following THREE
    websites:
    http://www.ddipro.com
    http://www.techddi.com
    http://www.datadoctor.biz
    2.     Describe (in maximum 30 Words) your Procedure/Method of calculating
    the number of Pages in above websites.

    "Transactions" are defined by the Application, not the Database. "COMMIT" and "ROLLBACK" are how the Database records transactions, but not how it defines them.
    One application may be inserting 1,000 rows per commit. Is this "1 transaction" because there is "1 commit" ?
    Another may be committing every row. Is this "1000 transactions" ?
    Within an application, one program -- a batch program -- session does 1,000 rows per commit every 10minutes. An online user commits every row, every 10 seconds for 30minutes.
    How do you count the "transactions" ?
    Transactions must be extremely well defined before you can count them. A transaction could be defined as "1 row inserted OR updated OR deleted , followed by an explicit commit, always" in one particular test.
    A transaction could be defined as "1,000 rows manipulated, followed by an explicit commit, always" in another test.
    ALSO SEE : http://www.freelists.org/post/oracle-l/number-of-transactions-in-a-day
    Edited by: Hemant K Chitale on May 26, 2009 10:03 PM

  • How to calculate the number of days until your next birthday. Only using current month, day and birth month and day.

    I'm trying to calculate the number of days until your next birthday. Only using current month, day and birth month and day. I can get close but i'm way off. When i enter in the next day, the amount of days is supposed to be 364. This is where I am having problems. I know my code is way off. I just need some guidance please!
    Attachments:
    D5.7_1.vi ‏8 KB

    I just had a little fun with the Time Record...
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    D5.7_1_BD.png ‏19 KB

  • How do you calculate the number of bytes in a hexidecimal array?

    Hi can anybody help me calculate the number of bytes in a hexidecimal array ie:
    04h + 12h + 4Eh + 20h = 84h
    Thanks

    Hi,
    I'm not sure if you want to count the bytes or sum the array. But here's an example of both:
    Hope this helps,
    Paulo
    Attachments:
    ByteCount.vi ‏18 KB

  • How to calculate the number of months....

    HI all
    can any body give the FM name which calculates the number of months between any two dates that are inputted
    thanks in advance

    Try this in ur source code of FM.....include the import and Export...as given
    ""Local interface:
    *"  IMPORTING
    *"     REFERENCE(BEGDA) LIKE  PA0001-BEGDA
    *"     REFERENCE(ENDDA) LIKE  PA0001-ENDDA
    *"  EXPORTING
    *"     REFERENCE(DIFF_MONTHS) TYPE  I
    *"  EXCEPTIONS
    *"      ENDDA_GRTR
      DATA : SMONTH TYPE I,
             EMONTH TYPE I,
             SDATE TYPE I,
             EDATE TYPE I,
             SYEAR TYPE I,
             EYEAR TYPE I,
             MONTHSTOBEADDED TYPE I,
             YRDIFF TYPE I,
             DIFF TYPE I.
    Calculating the months to be added
      SMONTH = BEGDA+4(2).
      EMONTH = ENDDA+4(2).
    Finding the difference in years
      SYEAR = BEGDA+0(4).
      EYEAR  = ENDDA+0(4).
      IF SYEAR <> EYEAR .
        SYEAR = SYEAR + 1.
        DIFF =  ( 12 - SMONTH ) + 1.
        YRDIFF  = EYEAR - SYEAR.
        IF YRDIFF > 0 .
          DIFF = DIFF + ( YRDIFF * 12 ).
        ENDIF.
        DIFF = DIFF + EMONTH.
      ELSE.
        DIFF = ( EMONTH - SMONTH ) + 1.
      ENDIF.
    DIFF_MONTHS = DIFF.
    ENDFUNCTION.

  • Customer credit memo can't auto calculate the net due date

    Hi all,
    Our user used F-27 to entry customer credit memo (PK = 11),
    [F-27|http://www.flickr.com/photos/44956360@N08/5206144134/]
    and payment term use net 60 days,
    [F-27 - screen 2|http://www.flickr.com/photos/44956360@N08/5206144210/]
    but the system display the net due date doesn't add 60 days
    [F-27 - screen 3|http://www.flickr.com/photos/44956360@N08/5206144292/]
    To use fbl1n display the net due date doesn't add 60 days
    [FBL1N|http://www.flickr.com/photos/44956360@N08/5206144344/]
    Why the system can't auto calculate the net due date when user used PK = 11, but If user use PK = 01, the system can auto calculate the net due date.
    Best regards,
    Eric

    Hi Henri,
    I found the answer, when user enter the original document number in reference field of credit memo, the system can auto calculated the net due date!
    no reference doc
    [PIC1|http://www.flickr.com/photos/44956360@N08/5208025267/]
    input reference doc
    [PIC2|http://www.flickr.com/photos/44956360@N08/5208623198/]
    Thanks for your help.
    Best regards,
    Eric

  • In Report I have a 2D axis system. How do I properly calculate the grid line interval for exactly 10 dots per tick

    Having trouble getting the dots to line up correctly with the ticks of a 2D axis.  I would like to have exactly 10 dots per tick.  The programming is no problem.  I set the D2AxisGridInterv variable after opening the 2D axis object.  I can't seem to figure out how to calculate the number that results in exactly 10 dots per tick.  I also have tried manually iterating to get 10 dots and have not been succesful.  What is this number based from?  It says as a percentage of the diagonal of the worksheet.  I can get pretty close to 10 dots per tick, but it is always off just a bit.  Is there really a way to get scientific based dots on a 2D axis so that the data can be analyzed from a printed plot?
    Thanks-Ryan

    Hi Ryan,
    I'm not entirely sure what you mean by "dots", but I'm going to guess you meant grid lines set to dot display.  In that case you can align the grid lines to the axis sub-ticks, then set the sub-ticks to invisible.  The sub-ticks can be set to N of them per axis tick.  Attached you will find an example of 10 dotted vertical grid lines per X axis tick.
    Let me know if you meant something else,
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments
    Attachments:
    Ryan37.zip ‏30 KB

  • How to re-order automatically the number of primary key column in MySql that has been set as auto_increment if one of the row deleted?

    Hello,
    Can anyone show me the way how to re-oder automatically the number of primary key that has been set as auto_increment in mysql database when the row deleted?
    example:
    No (primary key=auto increment)|
    Name |
    AGE |
    1
        | JO
    | 21
    |
    2
        | Kyle
    | 25
    |
    3
        | Macy
    | 30
    |
    When delete 1 row:
    No (primary key=auto increment)|
    Name |
    AGE |
    1
        | JO
    | 21
    |
    2
        | Macy
    | 30
    |

    Hello,
    This is not a VB.NET question, best to ask this question in
    MySQL forum.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

Maybe you are looking for

  • Background processing and downloading the data into File

    Hi , Can you please let me know how to find out the Programname whic is downloadng the data into Excel sheet from application server... thanks

  • MacBook Air not recognizing an LG external DVD burner?

    I have used this burner more than once before with this MacBook, yet this time it's choosing not to recognize it. I'm not familiar enough with Macs to know how to check myself if it's being recognized. Although I did go through the Disk Utility and n

  • Search Usage Report nt authority\iusr

    Hi, There seems to be some nt authority\iusr process account that is being tagged instead of a regular user account to search for  terms in our search application. The search usage log has many entries on this account name along with the other accoun

  • How to set condition for my Choose From List

    hi ..plz check my code...i want to set a condition on my CFL which opens GL Accounts..it has to show only Active Accounts...but when i run the program iam able to see all accounts..what might me the proble.. my code is as follows '''''''''' load form

  • System not abel to find storage bin .

    hI All , I am trying to do goods reciept in storage locatrion which is warehouse managed. required storage type indicator is assigned to material master . Storage type config is : Putaway strategy : I (addition to existing stock) Mixed storage:X