Without looping: Determine number of unique values in a set

Hi all,
I was wondering if anyone has any advice on determining the
number of unique items in a set. For example:
If I have an ArrayCollection
public var someData:ArrayCollection = new ArrayCollection([
{id:"1", color:"Red", value:5"},
{id:"2", color:"Red", value:"4"},
{id:"3", color:"Green", value:"17"},
{id:"4", color:"Red", value:"3"},
{id:"5", color:"Blue", value:"4"}]);
What I want returned is just Red, Green, Blue
but not Red, Red, Green, Red, Blue. Or even better would
just be a number telling me how many unique values are in the set.
I've spent hours digging through the asdocs but have not found
anything that performs this type of analysis and I've typically had
to resort to endless loops (which can affect performance when the
data set is large).
I would appreciate any words of wisdom.

"shawn.yale" <[email protected]> wrote in message
news:ghs5lo$fkb$[email protected]..
> Hi all,
> I was wondering if anyone has any advice on determining
the number of
> unique
> items in a set. For example:
>
> If I have an ArrayCollection
> public var someData:ArrayCollection = new
ArrayCollection([
> {id="1", color="Red", value="5"},
> {id="2", color="Red", value="4"},
> {id="3", color="Green", value="17"},
> {id="4", color="Red", value="3"},
> {id="5", color="Blue", value="4"}]);
>
> What I want returned is just Red, Green, Blue
but not Red, Red,
> Green,
> Red, Blue. Or even better would just be a number telling
me how many
> unique
> values are in the set. I've spent hours digging through
the asdocs but
> have
> not found anything that performs this type of analysis
and I've typically
> had
> to resort to endless loops (which can affect performance
when the data set
> is
> large).
>
> I would appreciate any words of wisdom.
You could use a GroupingCollection with a SummaryRow.
HTH;
Amy

Similar Messages

  • How do you count the number of unique values?

    I wanted to know how to create a function that will tell me how many unique values are in a list of values.
    For example if I had this list:
    15
    15
    12
    12
    12
    2
    1
    I would get a result of 4. Because there are only 4 unique values 15, 12, 2, and 1.
    I'm trying to create a spreadsheet that modeled the Sainte-Laguë method of voting; in case you're wondering. I'm using Numbers '09 if it matters.
    Thanks

    Thanks for the responses. That was fast.
    I was hoping to fit it all in one cell, but I guess I could hide the columns used for calculation. I tried Badunit's Function and it works. However I found that if I have a column of all the same number it will return 0, when in fact it should return 1. Like if I had a column of 14s I should get one, because the number of different values that appears is 1. Also a minor note is that COUNTIF(B$2:B2,B2) should be COUNTIF(B2:B$2,B2), that makes sure that if you have anything below it doesn't interfere. At least that's what made it work for me.
    Well I looked at the way you did your chart, Badunit, and it makes more sense than the way I was doing it. I was having to manually enter the number of seats every new row. I think it would have been easier to write a java program.
    Anyways you guys have been helpful. Thanks again.

  • Count the number of unique values in column

    Hi
    I have a large numbers file (thousands of rows) with data for different dates. I need to calculate the number of unique (distinct) dates are in the spreadsheet.
    Does anyone know how to do this?
    Thanks,
    Bruce

    bpj,
    Let's say your date is in column B for this example and your first data row is Row 2. In another column you can enter into row 2: =IF(COUNTIF($B$2:B2, B)=1, 1, "") Summing the new column content will yield the number if unique dates.
    As badunit observes, this will result in sluggish document. If the number of possible dates is small compared to the number of rows of data, it would be better to make a table of possible dates and count the number of occurrences of each of those dates in the data, a COUNTIF function on the frequency data for the date range will give you the number of unique dates, possible much more efficiently.
    Jerry

  • How to count unique values based on specific criteria

    Hello,
    I need to count the number of unique values in column A but only if the text in column I is a specific word - how do I do this? 

    Let's say the values are in A1:A10 and they are numeric, and the text is in I1:I10.
    As an array formula, confirmed with Ctrl+Shift+Enter:
    =SUM(IF(I1:I10="word",1/COUNTIFS(A1:A10,A1:A10,I1:I10,"word")))
    where "word" is the specific word you're looking for.
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • How to create surrogate key in dimension without unique value

    Hi, I have a dimension where there is no column with unique value. I want to add a surrogate key to replace the existing primary key which is derived from concatenating 3 columns(e.g. 'A'||'B'||'C'). I'm thinking of using sequence. But this won't allow me to link the dimension to fact table. How do I come up with surrogate key under this situation? Thanks. ~Tracy

    I'm actually trying to accomplish something similar myself.
    In my sources I've got two sorts of customers, ones that are directly reported, and ones whose information is provided with sales records (this is stored in module ODS).
    Of course identification is different, but in the datamart (module DWH) I'm sort of forced to use an equivalent way of loading (due to the way it first used to work). To accelerate lookups on dimensions, I copy the ODS surrogate key to DWH dimensions, but this does not work for the 'inbuilt' customers because they do not have a surrogate key in the ODS.
    They DO have means of unique identification, and at first I thought I could concatenate these (also 3) columns to use as identification code. Unfortunately this is VARCHAR2, where the surrogate key is (naturally) NUMBER.
    So now it looks like I'm forced to first build a table in ODS especially for these 'inbuilt' customers and assign a surrogate key (by sequence) to it, this way it conforms to how 'normal' customers are loaded into DWH.
    I guess you'll have to pull of the same trick, i.e. create a table with either only the 'translation' of D-code to a surrogate key or all information that is fed into the dimension, which then can be used as a lookup or as complete source when loading data into your datamart.
    Good luck, Patrick

  • Getting unique values from internal table

    Hi Gurus,
    From time to time I hit this problem and so far I havn't found any nice solution. I've an internal table with several fields. I would like to get all unique values for one (or several) of these fields. However let say that this table has a lot of entries so making a copy is not an option. Also changing this table in any way is forbiden.
    For example for table below I would like to get all unique values for field Number. In this case it would be 1,2,3,4.
    Name  | Number |
    name1 | 1|
    name2 | 2|
    name3 | 2|
    name4 | 3|
    name5 | 4|
    name5 | 3|
    Can anyone propose me better solution than going in the loop through all entries in table? Maybe there is some ABAP functionality that I don't know about?
    BR
    Marcin Cholewczuk

    Let's say that if I sort this table I won't be able to restore it to previous order which is important for me
    True...If you sort the table you won't be able to restore. So the only option is to copy/move all the records into another table.
    Sorting If you need to retrive unique values. I don't think without sorting the table would be a nice idea and proper programming to proceed ahead.
    Regarding logic, as replied earlier
    Either we can go with DELETE ADJACENT DUPLICATES or proceed as replied in my earlier post. There might be number of algorithms to resolve this. But we cannot go ahead without sorting or looping.

  • Determining number of teenagers living in a street

    I'm creating a java program to determine how many people are in a street, and how many of those people are teenagers. The information is gathered from an input file which is featured below.
    INPUT FILE*
    12 20 13 19 34 80 0 14 75 17 50 1 11 11 30 90 15 16 70 50 -2
    CODE*
    /* Session7A07.java */
    /* Determines number of teenagers living in a street */
    import java.util.*;
    import java.io.*;
    public class Session7A07
      public static void main (String[] args) throws FileNotFoundException
       /* variable declarations */
       int    age,
              people_count,
              teenage_count ;
       File age_file = new File("Session7A07.txt");
       Scanner age_data = new Scanner(age_file);
       age = age_data.nextInt();
       while (age >= 0)
          ++ people_count ;
          if (age >= 13 && age <= 19)
                  ++ teenage_count;     
          age = age_data.nextInt();
       System.out.printf ("Teenage Count = %d%n", teenage_count) ;
       System.out.printf ("People Count = %d%n", people_count) ;
    ERRORS_
    M:\>javac Session7A07.java
    Session7A07.java:23: variable people_count might not have been initialized
          ++ people_count ;
             ^
    Session7A07.java:25: variable teenage_count might not have been initialized
                     ++ teenage_count;
                        ^
    Session7A07.java:29: variable teenage_count might not have been initialized
       System.out.printf ("Teenage Count = %d%n", teenage_count) ;
                                                  ^
    Session7A07.java:30: variable people_count might not have been initialized
       System.out.printf ("People Count = %d%n", people_count) ;
                                                 ^
    4 errorsCurrently have 4 errors and would greatly appreciate the help.
    Thanks in advance.

    redfalconf35 wrote:
    int age,
    people_count,
    teenage_count ;the compiler doesn't like that you declared your variables but didn't initialize them to a valueTo expand on that: Member variables (those declared in the class, but outside of a method) are initialized with a default value if you don't explicitly initialize them. Variables declared in a method aren't given a default value, so if you use them without first setting their value, the compiler complains. Your while loop's body isn't guaranteed to be entered, so there's no guarantee that your variables will be set before use.

  • How to update unique values

    I want to update the unique values, if they are not inserted... Please help in this regard
    CREATE OR REPLACE PROCEDURE PR IS
    lv_operator VARCHAR2(1) := 'N';
    TYPE subset_rt IS RECORD
    ltt_whse_loc oe_sales_ord_commit.whse_loc%TYPE,
    ltt_shape oe_sales_ord_commit.shape%TYPE,
    ltt_isize oe_sales_ord_commit.isize%TYPE,
    ltt_grade oe_sales_ord_commit.grade%TYPE,
    ltt_length oe_sales_ord_commit.length%TYPE,
    ltt_pieces NUMBER,
    ltt_inv_lbs_commit oe_sales_ord_commit.inv_lbs_commit%TYPE,
    ltt_roll_lbs_commit oe_sales_ord_commit.roll_lbs_commit%TYPE,
    ltt_ishcom_lbs oe_sales_ord_commit.ishcom_lbs%TYPE);
    TYPE subset_aat IS TABLE OF subset_rt
    INDEX BY PLS_INTEGER;
    aa_subset subset_aat;
    errors NUMBER;
    dml_errors EXCEPTION;
    PRAGMA EXCEPTION_INIT(dml_errors, -24381);
    BEGIN
    lv_operator := sy_checkpriv(USER,
    'SY_OPERATIONS');
    SELECT whse_loc,
    shape,
    isize,
    grade,
    length,
    0,
    inv_lbs_commit,
    roll_lbs_commit,
    ishcom_lbs
    BULK COLLECT INTO aa_subset
    FROM oe_sales_ord_commit_temp
    WHERE processed_datetime IS NULL
    AND username = decode(lv_operator,
    'Y',
    username,
    USER);
    BEGIN
    FORALL indx IN 1 .. aa_subset.COUNT SAVE EXCEPTIONS
    INSERT INTO
    (SELECT loc,
    shape,
    isize,
    grade,
    length,
    pieces,
    inv_lbs_commit,
    roll_lbs_commit,
    ishcom_lbs FROM oe_inventory_temp)
    VALUES
    aa_subset(indx);
    EXCEPTION
    WHEN OTHERS THEN
    *+<<Trap the rows that have failed due to dup_val_on_index exception and update the inv_lbs_commit,+*
    *+roll_lbs_commit, ishcom_lbs columns in oe_inventory_temp table>>+*
    -- loc,shape, isize,grade, length, pieces are composite primary keys.
    errors := SQL%BULK_EXCEPTIONS.COUNT;
    DBMS_OUTPUT.PUT_LINE('Number of statements that failed: ' || errors);
    FOR i IN 1..errors LOOP
    DBMS_OUTPUT.PUT_LINE('Error #' || i || ' occurred during '||
    'iteration #' || SQL%BULK_EXCEPTIONS(i).ERROR_INDEX);
    DBMS_OUTPUT.PUT_LINE('Error message is ' ||
    SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE));
    DBMS_OUTPUT.PUT_LINE(aa_subset(SQL%BULK_EXCEPTIONS(i).ERROR_INDEX));
    END LOOP;
    END;
    END PR;
    /

    Due to the following restriction a number of simple collections is used instead of the collection of records.
    [FORALL Statement|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/forall_statement.htm#sthref2742]: You cannot refer to individual record fields within DML statements called by a FORALL statement. Instead, you can specify the entire record with the SET ROW clause in an UPDATE statement, or the VALUES clause in an INSERT statement.
    10g syntax of FORALL statement is used:
    SQL> select * from a;
           INT DT         STR
             1 10.02.2009 123
             2 11.02.2009 567
    SQL> desc a
    Name                                      Null?    Type
    INT                                       NOT NULL NUMBER(38)
    DT                                                 DATE
    STR                                                VARCHAR2(20)
    SQL> select * from a;
           INT DT         STR
             1 10.02.2009 123
             2 11.02.2009 567
    SQL> DECLARE
      2    TYPE T_Int_List IS TABLE OF A.Int%TYPE INDEX BY PLS_INTEGER;
      3    TYPE T_Dt_List IS TABLE OF A.Dt%TYPE INDEX BY PLS_INTEGER;
      4    TYPE T_Str_List IS TABLE OF A.Str%TYPE INDEX BY PLS_INTEGER;
      5  
      6    vInts T_Int_List;
      7    vDts T_Dt_List;
      8    vStrs T_Str_List;
      9 
    10    eBulk_Error EXCEPTION;
    11    PRAGMA EXCEPTION_INIT(eBulk_Error, -24381);
    12  BEGIN
    13    vInts(1) := 2;
    14    vDts(1) := sysdate - 1;
    15    vStrs(1) := '888';
    16 
    17    vInts(2) := 3;
    18    vDts(2) := sysdate - 22;
    19    vStrs(2) := '0000';
    20 
    21    BEGIN
    22      FORALL indx IN INDICES OF vInts SAVE EXCEPTIONS
    23        INSERT INTO A(Int, Dt, Str)
    24          VALUES(vInts(indx), vDts(indx), vStrs(indx));
    25    EXCEPTION
    26      WHEN eBulk_Error THEN
    27        DECLARE
    28          vErr_Count INTEGER;
    29          vErr_Message VARCHAR2(2000);
    30          vErr_Indices T_Int_List;
    31        BEGIN
    32          vErr_Count := SQL%BULK_EXCEPTIONS.COUNT;
    33          -- Getting the indices of rows with duplicate key
    34          -- FOR vI IN 1 .. SQL%BULK_EXCEPTIONS.COUNT LOOP - Doesn't work for some reason on 10.2.0.1.0
    35          FOR vI IN 1 .. vErr_Count LOOP
    36            IF SQL%BULK_EXCEPTIONS(vI).Error_Code <> 1 THEN
    37              -- Error other that duplicate key is reraised
    38              vErr_Message := SQLERRM(-SQL%BULK_EXCEPTIONS(vI).Error_Code);
    39              Raise_Application_Error(-20001, vErr_Message);
    40            END IF;
    41            vErr_Indices(SQL%BULK_EXCEPTIONS(vI).ERROR_INDEX) := SQL%BULK_EXCEPTIONS(vI).ERROR_INDEX;
    42          END LOOP;
    43       
    44          -- Bulk update
    45          FORALL vI IN INDICES OF vErr_Indices
    46            UPDATE A SET
    47                Dt = vDts(vI),
    48                Str = vStrs(vI)
    49              WHERE Int = vInts(vI);
    50        END;
    51    END;
    52  END;
    53  /
    PL/SQL procedure successfully completed.
    SQL> select * from a;
           INT DT         STR
             1 10.02.2009 123
             2 09.02.2009 888
             3 19.01.2009 0000Regards,
    Dima
    Edited by: DimaCit on Feb 10, 2009 10:39 AM

  • Need PlSQL code to find out the column/combination of columns from a given table which will be unique values

    Given a table with some columns and data associated with that. Need to find out a column or a combination of some columns, so that the values or combination of values will be unique in the table.
    The table and number of columns and the columns will be dynamic.
    Can you please help me with the solution?

    f8d0dcea-cdf0-4935-8734-632fe021456c wrote:
    No key is defined in the table.
    Suppose a table contains 20 columns then I need the unique combinations of all columns.
    Example: A table 'Employee' has 4 columns: Emp_No, Emp_Name,Passport_No,Emp_Designation. No key is defined for Employee table. Need to find out which column(single column and combination if columns) have unique values. Like, First check if Emp_No is unique then check Emp_No+Emp_Name is unique, then check if Emp_No+Emp_Name+Passport_No is unique, then check Emp_No+Emp_Name+Passport_No+Emp_Designation is unique.
    Then again try with the combination of Emp_No+Passport_No and so on. In this way I need to find out all the combinations having unique values.
    As Paul says, that will be a waste of time, as it will taken a lot of processing for all the possibilities, checking all the data each time to determine which combinations of columns provide uniqueness.  What happens if someone inserts or deletes some data whilst your doing it?
    You'd be quicker to manually look at the tables, and make an educated guess and then test for uniqueness with a quick query on that guess.

  • Maximum number of field values for an Authorization object

    Hello Experts,
    What is the maximum number of field values can be put into the role, Is there any restriction for number of values in any authorization field?
    I have put 326 values for field OBJTYPE in authorization object S_DEVELOP but not able to generate the role it is showing error.
    I know I can split the values in two or more instance but wanted to know if there any other way out for this (without creating more instances)
    Thanks
    DK

    If the values for OBJTYPE are not uniquely the same, then the system will not merge them - so nothing will be lost.
    Here is another trick for you: Choose one of the transactions in the role (or create a "symbolic" one for it") where you want to have the OBJTYPE proposed automatically from. Now maintain one or two of them in SU24 and then download it to your PC. Now from the F4 value range of the OBJTYPE, add all of those values you want via copy&paste into the file and then upload into SU24 again. A read old / merge new in PFCG will then swing all the values in for you.
    Single values are always better, as you do not know what else is hidden in the range or might be added in future. It is however common to see FROM / TO ranging around values such as DEBUG and FUGR although all aspects of S_DEVELOP are dangerous - even in display mode.
    Cheers,
    Julius

  • Get previous items unique value in new add item form

    Hi
    I have on list having items related to multiple locations.
    Every location is related to one user.
    When user logs in it filters the list with that users location.
    Now when user click on add new item I want to get the data related to his location using item event listener.
    But in new item form there is no way to get the location of that user in event listener as its new item.
    So I passed the qury string parameter form list and changed the add item form link and form to get the query string paramter as default value in Add new Item form.
    But again when user clicks on save button it redirects to original url without paramter. 
    How to redirect user to url with parameter on click on Save/Cancel.
    Is there any other way to get the previous item unique value in add new item from before executing the event listener?

    Hi,
    According to your post, my understanding is that you wanted to redirect user to url with parameter on click on Save/Cancel.
    You need to modify the onclick event need to as below:
    javascript: {{ddwrt:GenFireServerEvent('__redirect={{Home.aspx?Participant={@Participant}&amp;@Activity={@Activity}}}')}}
    Here is a similar thread for your reference:
    http://social.technet.microsoft.com/Forums/en-US/b506cfe5-650e-4017-b470-9ca0a75cd390/sharepoint-2010-list-how-to-pass-parameters-in-a-url-to-another-page?forum=sharepointcustomizationprevious
    In addition, you can creating an intermediate page which just finds the filed value with a DVWP and then redirect to RedirectURL with the filed value on the Query String.
    For more information, you can refer to:
    Redirect to Another Page from NewForm.aspx with the New Item’s ID
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • [[DataDirect][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Column name or number of supplied values does not match table definition.]

    Hii ..
    need help on this ..
    This what I am doing ..
    I am using a DATAEXPORT function to export level0 data from my essbase 11.1.2.2 to Microsoft SQL 2008 tables.
    So what I did first I exported the level0 data to a flat file using DATAEXPORT and the created the SQL columns by the same  in that order only in my SQL table.
    When I run it fails with this error:
    ODBC Layer Error: [21S01] ==> [[DataDirect][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Column name or number of supplied values does not match table definition.]
    [Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Info(1021014)
    ODBC Layer Error: Native Error code [213]
    [Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Error(1012085)
    Unable to export data to SQL table [dataexp]. Check the Essbase server log and the system console to determine the cause of the problem.
    [Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Info(1021002)
    SQL Connection is Freed
    [Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Warning(1080014)
    Transaction [ 0x1c50001( 0x51ee7d66.0x80342 ) ] aborted due to status [1012085].
    [Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Info(1012579)
    Total Calc Elapsed Time for [test.csc] : [1.44] seconds
    =============================================================
    I did a simple test on my Sample.basic application then ..
    loaded the calc data to it and then used the below script to export to a flat file
    //ESS_LOCALE English_UnitedStates.Latin1@Binary
    SET DATAEXPORTOPTIONS
                    DataExportLevel "Level0";
                    DataExportOverwriteFile ON;
                    DataExportColFormat OFF;
                    DataExportDimHeader OFF;
    FIX(
                "Jan",
                "Sales",
                "Actual"
    /*DATAEXPORT "File" "," "/home/hypadmin/samtest.txt";*/
    DATAEXPORT "DSN" "Abhitest" "sample" "sa" "welcome1";
    ENDFIX
    out put as below:
    "Sales"
    "100-30","California"
    "Jan","Actual",145
    Now In sql I created only 3 columns with name Jan/Sales/Actual and when I run this script again with comments removed .. I get the same error as what I have got in my first test case with other application ..
    but when I create the columns with same name as what its in export
    Sales/100-30/Califirnia/Jan/Actual
    It created the new rows successfully ..
    So with this I think the error which I am getting with my other application might be because of the same column issue  .. but then I have created all the columns by looking at the export file only as I did in sample ..
    Any idea would be helpful ..
    Thanks
    Abhishek
    I

    First make sure you add
    DataExportRelationalFile ON;
    to your set commands it is missing
    I alwats like to also add
    DataExportColHeader dimensionName;
    so I am sure what dimension is getting put into the columns.
    Then count the number of dimensions in your outline (exclude attribute dimensions). You need at least that many columns in your table  -1 + the number of  members you will be returning as columns in the export
    Taking your example Sample basic has 5 dimensions
    Measures
    Years
    Scenario
    Product
    Market
    Since you did not specify a dataexportcolheader it took the dense dimension Scenario as the columns. Your fix statement is limiting that to one member. Doing the math
    5 -1 + 1 = 5 columns in your table which is what you found works.  Suppose you fixed on bothe Actual and budget in scenario then you would need 6 columns 5 -1 +2

  • How do I count the unique value pairs in two columns of a table?

    I have a table (Table 2) that is populated with data from an imported .csv file. On table 1 I need to count the unique value pairs in two columns of Table 2.
    Here's what I have:
    Date                                        Person
    7/10/2011                         A
    7/12/2011                         W
    7/12/2011                         X
    7/12/2011                         X
    7/12/2011                         X
    7/12/2011                         Z
    7/14/2011                         Z
    7/15/2011                 X
    7/16/2011                         Z
    I'm focusing on person "X" and can easily count how many days that person shows up but what I want is to see on how many unique days that person shows up.
    Here's the result I'm looking for (Person "X" shows up on 2 different days - 3 times on 7/12/2011 and once on 7/15/2011):
    X                    2
    I can't seem to find a function that allows me to do that. I also am not allowed to modify Table 2 so that leaves me to come up with a solution on Table 1.
    Any ideas would be greatly appreciated.

    Hi John,
    Not being allowed to modify Table 2 is a minor inconvenience. Just copy (using a formula) the necessary two columns onto Table 1.
    Yellow columns may be hidden. The procedure progresses from left to right. All formulas are entered into row 2 then filled down that column to the end of the table. The table must be as long as the list in column A of Table 2.
    A2: =Table 2::A
    Fill right to column B.
    Fill both columns down as far as needed.
    I've used actual Date and Time values in column A, formatted to show only the Date part, but the technique will work with text in these cells, provided all cells representing the same 'date' have exactly the same content.
    C2: =A&B
    This concatenates the contents of each row of columns A and B into a single text string.
    D2: =COUNTIF($C$2:C2,C)
    This counts the number of occurrences of the Date&Name string on the current row from the first regular cell in column C (C2) to the current cell.
    E2: =IF(COUNTIF($B$2:B2,B)=1,MAX($E$1:E1)+1,"")
    This constructs the index of first occurrences of each name, in the order they first occur. The index is used by LOOKUP in column F.
    F2: =IF(ROW()-1>MAX(E),"",LOOKUP(ROW()-1,$E,$B))
    This uses the index value created in E as a search-for value to extract a single copy of the names in column B. The result is a list of all distinct names in the list. Note that spelling differences will be counted as distinct names.The IF statement stops the listing when the last distinct name is extracted.
    G2: =IF(LEN(F)>0,COUNTIFS($B,"="&F,$D,"=1"),"")
    This counts the number of 'first occurrences of distinct Date & Name strings for each name on the list (ie. the number of distinct dates on which each name appears in the original list).
    All of the functions used are described, with at least one example for each, in the iWork formulas and Functions User Guide. You can download the guide, and the Numbers '09 User Guide, via the Help menu in numbers.
    Regards,
    Barry

  • How to have a unique value for each record??

    could any 1 help me out in this...
    I want to have a column name 'Order No' which should be unique.
    How to generate a unique value for each record.??

    could any 1 help me out in this...
    I want to have a column name 'Order No' which should be unique.
    How to generate a unique value for each record.?? If you are using SQL PLUS to create the table try something like
    this:
    CREATE TABLE ORDER_TEST (
    ORD_NO NUMBER (8) NOT NULL PRIMARY KEY,
    ORDERDATE DATE,
    CUSTID NUMBER (8) NOT NULL,
    SHIPDATE DATE,
    TOTAL NUMBER (8,2) CONSTRAINT TOTAL_ZERO CHECK
    (TOTAL >= 0),
    CONSTRAINT ORD_FOREIGN_KEY FOREIGN KEY (CUSTID) REFERENCES
    CUSTOMER (CUSTID),
    CONSTRAINT ORD_UNIQUE UNIQUE (ORD_NO)
    -- or a simpler table example
    DROP TABLE ORDER_TEST;
    CREATE TABLE ORDER_TEST (
    ORD_NO NUMBER (8),
    ORDERDATE DATE,
    CUSTID NUMBER (8) NOT NULL,
    SHIPDATE DATE,
    TOTAL NUMBER (8,2) CONSTRAINT TOTAL_ZERO CHECK
    (TOTAL >= 0),
    CONSTRAINT ORD_UNIQUE UNIQUE (ORD_NO)
    note: ORD_NO can also be a primary key
    If you are doing the INSERT during runtime from a form first
    create a sequence in SQL PLUS to handle the ORD_NO value:
    Create SEQUENCE ORDERNO_UNIQUEVAL_sqnc
    START WITH 000001
    NOMAXVALUE
    NOCACHE;
    and reference it as the ORD_NO parameter in your INSERT
    statement:
    ORDERNO_UNIQUEVAL_sqnc.NEXTVAL
    note: to maintain data integrity you must use the sequence
    everytime you insert a new order to table. To start a new
    sequence drop the sequence and re-create it with whatever "START
    WITH" value you want.
    Hope this helps
    Kevin

  • Determining Number of Rows in a ResultSet

    Hi,
    Is there an easy way to determine the number of rows in a result set with TYPE_FORWARD_ONLY?

    > > Try ResultSet rs = statment.executeQuery(...);
    if(rs
    == null){ //result set is empty}That is incorrect... it should have read:
    ResultSet rs = statment.executeQuery(...);
    if( ! rs.next() )
    //result set is empty
    you're right!! copy/paste from executeUpdate( ) api documentation about statements....
    "a ResultSet object that contains the data produced by the given query; never null"
    here's the catch though: that will advance your result set, which will throw off your cursor in a while loop (used to parse the results). requires you to reset the cursor before processing the result set.

Maybe you are looking for

  • Installing OEM 10.2.0.5 on RHEL 5.2

    Hi all, I've been trying to install Oracle 10g R2 Enterprise Grid Control on RHEL 5.2 32-bit for week now with no luck. In OUI, the Configuration assistant "Agent Configuration Assistant" failed. When I tried to start it manually, I got the following

  • I'm trying to apply a logo graphic to a photo?

    I'm brand new to Adobe Photoshop Elements and also not very handy with computers.... I can't figure out how to add my logo to my photos, any help would be much appreciated?

  • Restiction on SAP Lumira user with BI_DATA_ANALYST role

    Hi, Is there an option to disable the SAP Lumira user with BI_DATA_ANALYST role from loading the Excel data into SAP Hana?   We would like the user to be able to create story boards and publish it on SAP LUMIRA server using HANA views but not allow h

  • SBO B1 2005 SP 01 Patch 11 - Issues with recordsets.

    Hi, We are using ‘recordset’ for Query all over our application. I have performance problems when I upgraded to SP01 Patch 11. Recordset retrieves the data fast but takes very very long time when I do movenext() or eof() or movefirst(). Here is a sam

  • DatePicker

    Hi I am developing a Desktop application. How to get Current time ? i want to update time in runtime?