Filter a view by the value of a field I have just started using Drupal (Drupal 7) and I would like your help to do something.
I have created a field called : Current Project where each user writes the project they are currently working on.
I want to create a view in each user's profile page that will show all the other users that work on the same project.
I tried to create this using the Views module but I can only insert a specific value as a filter. What I would like to do is to create a view that will show all users that have the same Current project as the viewed user.
Thank you very much for your help.
I don't think that's the best way to make this but here is an quick and dirty way :


Create your view and instead of using filter Click advanced and add contextual filter , then chose your field.
enable the PHP filter in modules
Create a block in admin/build/block and chose php filter there you will embed the php code below
now you have to load the profile of current user profile for this use this function, there you will find the current working project field and pass it to the views (I suppose that you added this field in profile 2) :
$path = drupal_get_path_alias($_GET['q']);
$path = explode('/',$path);
// if the position of viewed user id in the path is 1
$uid = $path[1];
$current_user = profile2_load_by_user($uid); 
//make print_r($current_user) to find your field of project currently working on
$arg = $current_user["main"]->your_custom_field["und"]["value"]; // if I remember
print   views_embed_view('your_view_machine_name','your_view_display_machine_name',$arg);


//to find out the machine name of your view hover over its ling and you will see then name in the link below 

This solution is for just one argument , if you have multiple field value (more than one current project) you will have to select mut pass arguments like this :

foreach ($current_user["main"]->your_custom_field["und"] as $record) {
            $values[]= $record["value]";
    }
$args =implode('+',$values);
views_embed_view('your_view_machine_name','your_view_display_machine_name',$args);

Hope this will help