Filter Data Source on Field Name ='Value' and User = [Me] RRS feed

  • Question

  • Hi All

    I've creatd a new datasource in SharePoint Designer 2010 (Right click a datasource and do 'Copy and Modify').

    I want to filter on 2 fields. The first field is just a choice 'Active' and 'Inactive'. So I'm filtering records that are 'Active'. This works fine.

    The 2nd thing I want to do is filter by current user. I have a field that contains user logon info, it's in the correct format of domain\user. I've tried setting the user filter by using [Me] but it just wont work. If I actually add a domain\username directly into the filter it works fine so I know there isn't anything wrong with my data.

    I'm binding this Data Souce to a DVDropDownList control.

    I just cant filter by current user. Does anyone have any ideas?


    Wednesday, February 6, 2013 4:34 PM


All replies

  • Did you try using Current User Filter Web Part?



    Wednesday, February 6, 2013 5:15 PM
  • Hi IT_Rich,

    When you create a new data source, add filter on people and group, it can’t be me or current user. As a workaround, you can create a SOAP service connection data source. First, you can create a view, filter by me or current user, then when you create the soap data source, set the list view name actual, by default is the default view.

    For more information, see


    Best Regards.

    Kelly Chen
    TechNet Community Support

    Thursday, February 7, 2013 8:38 AM
  • Hi both

    Thanks for your replies. I will check out the articles and see if I can achieve what I need. I really need to achieve the filter by current user by ‘Active’ records..

    Just to add, I've half achieved what I need another way using javascript for another function. I think all I need is some help in adding another filter to that code. I can then apply to this function instead of using a data source.

    I'll explain what the code does then paste the code below.

    This code is used in a holiday request form. I'm filtering a lookup field to only display the current username for the logged on user. The field contains all of our users but the code successfully filters and only displays the username for logged on user. (So it only allows a user to book their own holiday).

    If I know how to add a second filter, for the Active field for example, I think I'll be sorted. The code below successfully filters by username so we know we can achieve this.

    I'm know code expert at all, I've just done a large amount of research to find the code below.

    Thanks for your help guys.

    <script type="text/javascript">

     $(document).ready(function () {

      var loginID = $().SPServices.SPGetCurrentUser({
        fieldName: "Name"

     relationshipList: "Employee Directory",
     relationshipListColumn: "Full_x0020_Name_x0020__x0028_Pre",
     columnName: "Employee",
     CAMLQuery: "<Eq><FieldRef Name='AD_x0020_Account' /><Value Type='Text'>" + loginID + "</Value></Eq>",
     completefunc: null,
     debug: true

        operation: "GetListItems",
        async: false,
        listName: "Employee Directory",
        CAMLViewFields: "<ViewFields><FieldRef Name='ID' /><FieldRef Name='Full_x0020_Name_x0020__x0028_Pre' /></ViewFields>",
        CAMLQuery: "<Query><Where><Eq><FieldRef Name='' /><Value Type='Text'>" + loginID + "</Value></Eq></Where></Query>",
         completefunc: function (xData, Status) {
          $(xData.responseXML).SPFilterNode("z:row").each(function() {
          var varEmpID = ($(this).attr("ows_ID"));
          var varEmpFull = ($(this).attr("ows_Full_x0020_Name_x0020__x0028_Pre"));
            {value: varEmpID });
            var liHtml = "<li>" + varEmpID + "</li><li>" + varEmpFull + "</li>";

     varEmpConcat = varEmpID +";#"+ varEmpFull ;

    Thursday, February 7, 2013 9:36 AM
  • Check the below thread to get the filed value you want .


    For filtering use one more where condition in CAML query. http://buli.waw.pl/caml-query-multiple-conditions-in-and-or-clause/

    MCTS,MCPD Sharepoint 2010. My Blog- http://www.sharepoint-journey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Vote as Helpful

    Thursday, February 7, 2013 11:31 AM