How To filter data set based on value from another

I have a data set that contains rows with a column for "User ID". I want to filter a second data set that contains one or more user "role names" by "User ID" .  I want to do this dynamically without having to define a parameter. I then want to to take the filtered "Role Names" data set and display on a report.  Any pointers would be appreciated.

Data Set #1
User ID     First     Last ........
crace        Chares  Race
mmiller      Mike     Miller

Data Set #2
User ID     Role
crace        administrator
crace        guest
mmiller      guest

Desired Report Result

Page 1
crace      Charles Race
Roles       administrator
              guest

Page 2
mmiller     Mike Miller
Roles       guest

------------------------------------------------------

Thanks
Charles


Answer this question

How To filter data set based on value from another

  • jefflipe

    Hi,

    cycle through data set 1 with a for loop and save the id. then cylcle with a second loop through dataset 2 and look for the user ID. Then you have a variable which contains the row where this user is in the first dataset and a diferent one, which contains the rownumber in which the user is in dataset 2.


  • PJFINTRAX

    Even though this would work it wouldn't be very efficient as there are over 20,000 rows to traverse through.  Would there be a more efficient approach

    Thanks
    Charles

  • devbit

    Hi,

    can you not use a sql statement with a where clause when retriving your data from the database ! so you would have one huge dataset containing the data in the way you want to have it.

  • radhesh

    When importing the data into the new dataset, store the key in a array (or hashtable) and before inserting the next record - check the hashtable if it already contains the key, if so skip it.....
  • How To filter data set based on value from another