How to count values being outputted ?

I have a loop running through a DB and the program outputs values such as below to the screen, where the first character is varied it can be any value (eg ABC WON, or XYZ LOST) , and the output can also be of varying lengths.
How could the program count up the number of wins etc for each one e.g. output D Won 1, A Lost 2, A Won 1, A Drawn 1 etc
D WON
A LOST
C WON
A LOST
A DRAWN
B DRAWN
B WON
D LOST
C WON
B LOST
A WON
D LOST
I tried using an array but could not get it to work, ideas would be v. appreciated,
thanks
(sorry for the caps but thats output of the program ;) )

Create a class Team which contains Name, Wins, Losses.
Use a Map to store the instances of Team, the Key being the team name, the value being the Team instance.
Whenever you want to update the teams win/loss record, ask for the team by name from the map.
If it returns null, create and add a new team.
If it returns a Team, simply update the Team instance.

Similar Messages

  • How to count values in a query ?

    Hi experts,
    We have a query, which is having only characteristics. There are no key figures.
    There is date field. In this date field the value may be or may not be there.
    My requirement is if the date field has value then it should be counted record wise and the total count
    should be displayed in the bottom of the query output. If value is not there then that record should not be
    counted.
    How can we do this ?
    Regards,
    Nishuv.

    Dear Nishuv,
    You can create a calculated keyfigure for getting count, in that create a formula variable on characterstic with replacement as processing type.
    and please clarify  on what level you wanted to count, like Sales Docuement level or Item level.
    For Example :
    If you wanted to find no.of sales orders which are returned so  you have to count on document level. this would be the replacement characterstic.
    Please find the below PDf  you will understand better
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/009819ab-c96e-2910-bbb2-c85f7bdec04a
    Thanks
    Sreekanth

  • How to count values by using cursor

    HI,
    I want to check column is empty or filled. and i should use cursor not indipendent SQL query. I written my programe like this. but count(cursor.columnname) not taken how can i do this. please help me.
    declare
    cursor c_rec is select *from ppc_input_file;
    begin
    FOR c_rec IN c1 LOOP
    dbms_output.put_line('@@@@' || c_rec.device_name);
    IF COUNT(c_rec.ppc_method) THEN
    dbms_output.put_line('hihihh');
    ELSE
    dbms_output.put_line('nononono');
    END IF;
    END LOOP;
    venkat.

    Hi,
    Please go through the pl/sql docs carefully before you start writing codes.
    Please follow the link and read first.
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261.pdf
    declare
    cursor c1 is select * from ppc_input_file;
    This was wrongly written as cursor c_rec is select *from ppc_input_file;.
    begin
    FOR c_rec IN c1 LOOP
    dbms_output.put_line('@@@@' || c_rec.device_name);
    The following bold portion is unnecessary. If the count is zero the cursor for loop will not run. I am not sure of your requirement.
    --IF COUNT(c_rec.ppc_method) THEN
    --dbms_output.put_line('hihihh');
    --ELSE
    --dbms_output.put_line('nononono');
    --END IF;
    END LOOP;
    end;
    regards,
    Dipankar.

  • Urgent : JDBC How to Count Values in result set.

    Hi all,
    How can i find the size of ResultSet i.e. The number of records returned by a select statement.
    Thanks in advance.
    Abhishek

    int nb = 0;
    while (rs.next())
    nb++;

  • How to get counter value from Historian

    Hi Experts,
    We have got a scenario to keep the number (counter) to see how many time a value of tag have been changed.
    For Example:
    If the values change from 1 to 0 and  0 to 1 for 25 times in a minute. We would like to get this number (25) from Historian (Wonderware).
    Currently we are not using any Pco to fetch the value from Hisotrian since we are able to fetch the tag values from Historian database through SQLConnection.
    I would like to know if we introduce Pco, will that help us to get this counter value.
    We are working on MII 15.0 version.
    Any help of this very much appreciated.
    Thanks
    Shaji

    Hi Shaji,
    PCo OPC DA does not support  PCoQuery TagAggregateMode as it only has access to Current Values of OPC Tags, because OPC DA only provides Current Value access.
    I know it is possible to execute SQL queries against the Wonderware Historian to retrieve counts aggregates, but don't have the details handy. Recommend that you deploy the InSQLPCo Data Server in MII and try using the PCoQuery TagAggregateMode method to retrieve the Counts aggregate first.
    Regards, Steve

  • How to get counter values from pci 6221 card?

    Hii
     I am using PCI 6221 card .. In that i am using the ctr o .. In my application i am using Linear encoder to measure the Lift movement.. so from software how to access the counter values i.e how much mm it moves... 

    Measure Angular Position.vi in the LabVIEW examples will be a good starting point. Adapt it to Linear Encoder by clicking on the selector below DAQmx Create Channel.vi.
    You can also create a corresponding DAQmx Global Channel (or task) in MAX and then use it in your code.
    Feel free to post back if you need further help.
    Message Edité par JB le 10-31-2008 02:15 PM

  • How to get value in a web page automatically  and sava output in database

    how to get value this table output is
    row 1, cell 1
    row 1, cell 2
    row 2, cell 1
    row 2, cell 2
    <table border="1">
    <tr>
    <td>row 1, cell 1</td>
    <td>row 1, cell 2</td>
    </tr>
    <tr>
    <td>row 2, cell 1</td>
    <td>row 2, cell 2</td>
    </tr>
    </table>

    Note: This thread was originally posted in the [Java Technologies for Web Services|http://forums.sun.com/forum.jspa?forumID=331] forum, but moved to this forum for closer topic alignment.

  • How to suppress a property being output to a label once a date has been reached

    Hi,
    I would like to suppress a property being output to a label once a date has been reached. I have tried the WWI conditional output functionality but am experiencing issues.
    The issue is the symbols I am wanting to use have different expansion times.
    For example:
    The property contains a CHAR30 phrase-related characteristic and a DATE FORMAT characteristic.
    I only want to output the phrase if the current date the label is printed is the same or later than the date assigned in the property.
    When I try to create the conditional output:
    <11BRG200(M,ZSAP_EHS_1011_014;*)>
    <15BIF100(AND:01GZE1_ZE145 GE S:02EHS_RPPRIN)><01GZE1_ZE10G(P;*)[D:Grant
    No.]> <15EIF100>
    <11ERG200>
    On checking the template, I get the message 'Repeating group IF 100: Different expansion times for condition symbols'
    SAP Help does tell me that:
    · If you enter a number of symbols in the condition, these must all have the same expansion time. If you require a conditional output that is dependent on symbols with different expansion times, you have to nest a number of conditional outputs.
    Does anyone know how I can achieve this?
    Best regards
    Karen Waterworth

    Hi Michael
    I will try that as the date is unlikely to be changed (unless incorrect), and it is exactly what we are wanting to achieve, only output the Grant number when printing the label if the expiry date has not been reached.
    Example of data held in SAP:
    Header 1
    Header 2
    Grant No.
    US 5,590,111
    Country
    US
    Expiry Date
    01.01.2035
    Usage
    LABEL: US
    Grant number only output until expiry date reached (ie earlier or same date, not later as I put in my question!)
    Thank you
    Karen

  • How do I program a NI 6602 card to send trigger pulses, one at each output port, triggered by an input trigger signal, using only one counter for each output port?

    Hello,
    I have managed to program a NI 6602 card in LabView to send pulses on three different output ports, one pulse on each output port (with individually chosen delays) for each input trigger pulse coming on a separate input port. It is the DAQmx Create Channel (CO-Pulse Generation-Time)-VI that I have used for this, see attached code. However, this VI controls both pulse delay and pulse width, and therefore uses two counters for each output port (although you only specify one counter in the VI input signals), as I understand.
    In my application though, I only need to have the delay chosen, the pulse width can be arbitrarily short, and thus I should only need one counter for each output port. How do I accomplish to program this in LabView?
    Best regards,
    Claes
    Attachments:
    Configure Side Camera Flash 1 Triggering.vi ‏47 KB

    Well you're welcome to do that--it will work just fine as long as you are configuring a start trigger.
    <rant>
    However, personally I really don't like putting multiple counter outputs in the same task.  I have seen so many people assume that the counter outputs would be synchronized due to having them in the same task when this is not the case (you need to configure a start trigger in order to synchronize the counter outputs even if they are in the same task).  This is the only case I can think of where multiple channels in a DAQmx task are not automatically synchronized.
    As an example:
    Running this on my PCIe X Series gives a measured 2 edge separation of 1 ms + {7.78 us - 10.11 us}.  This would likely be much worse on a bus with more latency (e.g. USB).
    The resulting output is close enough to what you might expect that it might go unnoticed, but really these counter outputs are not synchronized and it would be easy to glance at the code and not even think twice about it.  For the small amount of extra work on my end to create a separate task for each counter, it really clears up some ambiguity about what the counters are actually doing.  For me it's worth it.
    So again, for your case there really isn't a problem with having the counters in the same task since you are using an external start trigger anyway.  I have just gotten in the habit of avoiding doing this.
    </rant>
    Best Regards,
    John Passiak

  • How can i save the values of output waveform in array ?

    hi
    how can i save the values of  output waveform in array ?

     how can i save the values of  output waveform in array ?
    the program is attachment bellow
    Attachments:
    closed loop transfer fn+fuzzy.vi ‏28 KB

  • How to dynamically set Min count and Max Count values in Adobe Print Form?

    How to set the Min Count and Max Count values dynamically in a Print Form?
    The values when set should over ride the values set in Binding Tab.
    This is all needed to print multiple Material Number labels on a single page - and the number of labels to be printed needs to be under user control - something like an Avery Address labels
    Please advise.
    Thanks,

    Here is a work around that works for me and may not be an intelligent solution .
    I kept the Min Count to 1 on the subform binding properties.
    Per the number of labels required, I appended the same item to the internal table so many times and passed it to the label.
    it works fine for my requirement.
    However - leaving out the post for a while to see if this can be done at the form level via scripting.
    Thanks,

  • How to use NODIM func with out it's values being rounded

    I created a new calculated key figure in Query Designer 3.x, and used the function NODIM() - Value with out dimensions. When I use this function, the values are rounding off to the nearest value.
    For example, I have a value 0.000075 US$, when I use NODIM function the value is displayed as 0.000080. Value is getting rounded to nearest value.
    I tried using absolute value it did not work.
    Can any one tell me how to use NODIM function with out it's value being rounded to nearest value.
    Thanks,

    Hi,
    According to your description, you might want that "Notice" field has a default value when form is created and users can be able to change the value of that
    field.
    As a workaround, you can add an action rule in “Name” field via InfoPath to fill the default value in “Notice” field only when “Name” field is not blank and “Notice”
    field is blank.
    Settings of the rule are as below, you can modify it based on your need:
    Here is a link about how to add an action rule in InfoPath form, you can use it as a reference:
    https://support.office.microsoft.com/en-us/article/Add-rules-for-performing-other-actions-5322d726-b787-4e5f-8d37-ba6db68b451d?CorrelationId=8a64c12f-aa60-4d90-b1f9-a44fcc4e74b5&ui=en-US&rs=en-US&ad=US
    Best regards
    Patrick Liang
    TechNet Community Support

  • How to get record count value in variable

    Hi,
    i wanted to capture record count value in the variable?
    Please let me know how to do this?
    Thanks,
    jag

    To determine count of records, use: count(field_name) -- replace field_name with your appropriate field.
    You don't have to save the record count value in a variable. You can directly use the condition <?if: count(field_name) > 0?> display table <?end if?>
    If you want to store it in a variable: use <?variable:record_cnt;count(field_name)?>
    Take a look at this post that uses a record count: https://blogs.oracle.com/xmlpublisher/entry/no_data_found
    Thanks,
    Bipuser

  • How to count Unique Values in BEx

    Hi Guys,
    Can anybody please let me know how to count unique values of a characteristic.
    Thanx in advance
    Peter

    I have a similar scenario. If i drill up on the characterstic that had a count of one in each record, the total number of records should be stay equal to the summarised results in the last screen.
    Would someone know how to do that .
    Arti

  • How do i pass a value to Output field in a standerd screen...?

    Hi all..
    I have a developed a BDC program for User upload,  I'm facing problem to pass a value to Output field..
    Its Displaying Status Message as ZSHIPTO is not a Input field,
    looking forward to hear from you all,
    thanks in anticaipation,
    full points will be awarded for usefull answer..
    regards,
    Sekhar.

    just check in transaction whethere that field is an input field or not ( imean to say that field is in the display mode (gray field) or it is in change mode(input is accept).
    also check for that particular field in the coding .
    Thanks

Maybe you are looking for

  • Issue with to_number

    Hello all. Please explain me the following phenomena, i cant figure this out. Why is 'to_number' function forced by the optimizer in this query @ the operation number 11 ? SQL> select * from v$version; BANNER Oracle Database 10g Enterprise Edition Re

  • Suitable Laptop for NI ExpressCard 8360

    Hello, I'm looking for an Industrial Laptop, which supports NI ExpressCard 8360 with NI PXI Chassis(8 & 18 slots). we have tried with couple of laptops(HP ProBook & Dell XPS), which has the follwing issues: 1. Booting (This could be fixed by changing

  • Chapter Title Text Frame Questions

    I have a book with some side heads, and I made a master page with a simple grey background.  It works great when the chapter title is short: (the grid pattern is a screen capture artifact--on my screen is a solid grey) I put an empty paragraph in the

  • User define field in inventory tracking

    Hi there, I found out that there is no UDF allowed in inventory tracking i need UDF like bin location to indicate each item on different bin code. Anyone has any solution for this scenario? Thanks

  • Question about saving CS5.5 .indd files to open in CS5

    Do I need to export my InDesign CS5.5 as an IDML in order to open it in InDesign CS5?*