locked
Applying business rules to filtered members RRS feed

  • Question

  • Hi All,

    My intention is to filter a number of entitymembers (rows) and after that apply a business rule to the filtered rows. Now I have 2 questions:

    1. Is this possible at all ?
    2. In my filter i used the name attribute, the operator type is like and i put in 'P%' as criteria. By applying the filter I would expect that only the member whose name start with a P would be selected, but instead all rows are filtered out.


    Any ideas ?

    Cees

     


    Please remember to mark the replies as answers or at least vote helpfull if they help and unmark them if they provide no help.
    Monday, September 27, 2010 1:13 PM

Answers

  •  

    1. Is this possible at all ?
    2. In my filter i used the name attribute, the operator type is like and i put in 'P%' as criteria. By applying the filter I would expect that only the member whose name start with a P would be selected, but instead all rows are filtered out.

     

    Hi All,

    Just figured it out myself. The answer to question 1 is obviously Yes.

    Answer to question 2 would still be welcome, alltough I now foud a work-around using Matches as an operator instead of Like.

     

    Kind regards,

    Cees


    Please remember to mark the replies as answers or at least vote helpfull if they help and unmark them if they provide no help.
    Monday, September 27, 2010 1:25 PM
  • Hi Cees,

     

    with API,I found that LIKE and MATCH work both but I cannot see any difference in results

     

     EntityMembersGetCriteria emgc = new EntityMembersGetCriteria();
       emgc.EntityId = entityId;
       emgc.ModelId = modelId;
       emgc.VersionId = versionId;
       emgc.PageSize = 10000;
       emgc.DisplayType = DisplayType.NameCode;
       string MemberNameToSearchFor = "P%"; //string Member2NameToSearchFor = "yourMemberCode2";
       //emgc.SearchTerm = String.Format(" [Code] IN ('{0}','{1}') 0.5 1 0.32 ", MemberNameToSearchFor,Member2NameToSearchFor);
    
       emgc.SearchTerm = String.Format(" [Name] LIKE '{0}' 0.2 1 0.32 ", MemberNameToSearchFor);
    // or you can use emgc.SearchTerm = String.Format(" [Name] MATCH '{0}' 0.2 1 0.32 ", MemberNameToSearchFor);
    
       EntityMembersInformation emi = new EntityMembersInformation();
       Form1 frm = (Form1)Form1.ActiveForm;
       if (frm != null)
       {
        using (MDS_WS.c = frm.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));
    
         }
    
         lstMembers.DisplayMember = rbNameCode.Checked ? "NameCode" : "CodeName";
    
        }
    }
    
    

     

    please see comments from Alexey for more information about searchTerm in

    http://sqlblog.com/blogs/mds_team/archive/2010/04/21/updated-product-documentation-and-resources.aspx

    Regards,


    Xavier Averbouch
    Wednesday, September 29, 2010 8:57 AM

All replies

  •  

    1. Is this possible at all ?
    2. In my filter i used the name attribute, the operator type is like and i put in 'P%' as criteria. By applying the filter I would expect that only the member whose name start with a P would be selected, but instead all rows are filtered out.

     

    Hi All,

    Just figured it out myself. The answer to question 1 is obviously Yes.

    Answer to question 2 would still be welcome, alltough I now foud a work-around using Matches as an operator instead of Like.

     

    Kind regards,

    Cees


    Please remember to mark the replies as answers or at least vote helpfull if they help and unmark them if they provide no help.
    Monday, September 27, 2010 1:25 PM
  • Hi Xavier,

    Any changes that Is Like will work as well ? This is what I see in the help on filters:

    • Uses the LIKE operator from Transact-SQL to filter results. For more information, see LIKE (Transact-SQL) in SQL Server Books Online.

    Any experiece with that ?

    Kind regards,

    Cees

     


    Please remember to mark the replies as answers or at least vote helpfull if they help and unmark them if they provide no help.
    Monday, September 27, 2010 1:48 PM
  • Hi Cees,

     

    with API,I found that LIKE and MATCH work both but I cannot see any difference in results

     

     EntityMembersGetCriteria emgc = new EntityMembersGetCriteria();
       emgc.EntityId = entityId;
       emgc.ModelId = modelId;
       emgc.VersionId = versionId;
       emgc.PageSize = 10000;
       emgc.DisplayType = DisplayType.NameCode;
       string MemberNameToSearchFor = "P%"; //string Member2NameToSearchFor = "yourMemberCode2";
       //emgc.SearchTerm = String.Format(" [Code] IN ('{0}','{1}') 0.5 1 0.32 ", MemberNameToSearchFor,Member2NameToSearchFor);
    
       emgc.SearchTerm = String.Format(" [Name] LIKE '{0}' 0.2 1 0.32 ", MemberNameToSearchFor);
    // or you can use emgc.SearchTerm = String.Format(" [Name] MATCH '{0}' 0.2 1 0.32 ", MemberNameToSearchFor);
    
       EntityMembersInformation emi = new EntityMembersInformation();
       Form1 frm = (Form1)Form1.ActiveForm;
       if (frm != null)
       {
        using (MDS_WS.c = frm.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));
    
         }
    
         lstMembers.DisplayMember = rbNameCode.Checked ? "NameCode" : "CodeName";
    
        }
    }
    
    

     

    please see comments from Alexey for more information about searchTerm in

    http://sqlblog.com/blogs/mds_team/archive/2010/04/21/updated-product-documentation-and-resources.aspx

    Regards,


    Xavier Averbouch
    Wednesday, September 29, 2010 8:57 AM
  • Hi Xavier,

    Thanx again for your reply. I'm not into API's myself. My primary job is (BI) implementation consultant. However I see that the ablity to dive into this APII's  could be very handy, especially with this realtively 'new' product. Where are thes API's stored and how can I open them ?

     

    Kind regards,

    Cees


    Please remember to mark the replies as answers or at least vote helpfull if they help and unmark them if they provide no help.
    Thursday, September 30, 2010 11:44 AM
  • Hi Cees,

    you can find a complete example on my codeplex release:

    http://mdsmanager.codeplex.com/

    Regards,

     


    Xavier Averbouch
    Thursday, September 30, 2010 11:52 AM