locked
Get members by code RRS feed

  • Question

  • Hi,

    I'm struggling to find a way to get specific members by code.

    I have tried the following:

    • Thought there would be a MemberIdentifer collection in EntityMembersGetRequest.MembersGetCriteria I could populate, but there is not. This would be the most logical
    • Then the only one left is to use EntityMembersGetRequest.MembersGetCriteria.SearchTerm. However, as I have seen on other sites and also tried myself, "OR" does not work here. "AND" and "LIKE" does, but this doesn't help me in this case.

    It's definitely not ok to have to make a call per member to get, that would lead to horrible performance when I want to search for 100 or 1000 members (the case I'm on can theoretically have this large set).

    How am I supposed to solve this?

    Friday, September 10, 2010 7:49 AM

Answers

  • Just to let others now, who are struggling with the same problem, I have received a solution to this problem from a contact at Microsoft.

    It is as simply as that the "IN" operator is also supported, which makes it possible to search like this: "[Code] IN ('X', 'Y')". Good!

    • Marked as answer by agidlund Thursday, September 16, 2010 10:20 AM
    Thursday, September 16, 2010 10:20 AM

All replies

  • Hi agidlund,

     

    here is an example i've made with search term, i've tested and it's working.

     

     

     EntityMembersGetCriteria emgc = new EntityMembersGetCriteria();
      emgc.EntityId = entityId;
      emgc.ModelId = modelId;
      emgc.VersionId = versionId;
      emgc.PageSize = 10000;
      emgc.DisplayType = DisplayType.NameCode;
      string MembersCodeToSearchFor = "What you want to search";
      emgc.SearchTerm = String.Format(" [Code] MATCH '{0}' 0.5 1 0.32 ", MembersCodeToSearchFor);
      EntityMembersInformation emi = new EntityMembersInformation();
      using (MDS_WS.c = ((Form1)Form1.ActiveForm).mds.CreateMdsProxy())
      {
      EntityMembers em = Common.MDS_WS.c.EntityMembersGet(Common.MDS_WS.intl, emgc, out emi, out Common.MDS_WS.or);
    
      if (em != null)
      {
       Common.MDS_WS.colMembers = em.Members;
      }
    
      lstMembers.Items.Clear();
    
      foreach (Member m in em.Members)
      {
    
       lstMembers.Items.Add(new MemberNameCode(m.MemberId));
    
      }
     }
    

     

    Regards,

     


    Xavier Averbouch
    Friday, September 10, 2010 9:27 AM
  • Yeah, but that only let you specify one value for sought attribute, right? I want to search and return members with exact code 'X' or 'Y'.
    Friday, September 10, 2010 11:20 AM
  • Yes,

     

    You can only specify one value because OR is filtered/not yet implemented in MDS

    please see comments from Alexey Gudzera here:

    sql mds link

    Regards,

     


    Xavier Averbouch
    Friday, September 10, 2010 3:08 PM
  • Just to let others now, who are struggling with the same problem, I have received a solution to this problem from a contact at Microsoft.

    It is as simply as that the "IN" operator is also supported, which makes it possible to search like this: "[Code] IN ('X', 'Y')". Good!

    • Marked as answer by agidlund Thursday, September 16, 2010 10:20 AM
    Thursday, September 16, 2010 10:20 AM