ExcludeMembers problem

Posted by: derryt on 3 August 2017, 4:02 pm EST

  • Posted 3 August 2017, 4:02 pm EST

    I'm having a problem using ExcludeMembers, I keep on getting the following error:- "Members can not be excluded due of some restrictions"



    Here if the code, I'm sure it's something simple.



    IMemberFilter memberFilter = (IMemberFilter)filter;

    foreach (Member m in memberFilter.RootMembers)

    {

    if (memberFilter.IsMemberIncluded(m))

    {

    actions.ExcludeMembers(filter.FieldUniqueName.ToString(), string.Format("[{0}].&[{1}]", filter.FieldUniqueName.ToString(), "1996"));

    }

    }
  • Replied 3 August 2017, 4:02 pm EST

    Sorry I pasted the wrong code in it is



    SchemaDefinition schema = pivotProcess.DataSource.Schema;

    Hierarchy fieldfilter = schema.Get("[WorkCompleted].[PSD_Step_Description_SentFrom]");
  • Replied 3 August 2017, 4:02 pm EST

    not a paste problem your site is dropping the ""
  • Replied 3 August 2017, 4:02 pm EST

    Derry,

    I have attached a small sample application which demonstrates the usage of ExcludeMembers method. I could not find anything obvious in your code; however you may want to take a look at the attached sample and see if that helps. You will need to update the Nwind local cube path in the LocalCubeDatasource before you run the application. The same exception was reported here by one of the users but it is more likely related to the datasource being used.

    Regards,
    Sankalp

    2013/01/ExcludeMembers.zip
  • Replied 3 August 2017, 4:02 pm EST

    Hi Sankalp



    Thanks for that, I've checked your example and tried to simpulate your code in my project.



    I run the two projects side by side in debug yours works mine does not.



    SchemaDefinition schema = pivotProcess.DataSource.Schema;

    Hierarchy fieldfilter = schema.Get("[WorkCompleted].[PSD_Step_Description_SentFrom]");



    What is returned is null in my "fieldfilter" even though when I view the info in the "schema" I can see this field exactly the same as in your example.









  • Replied 3 August 2017, 4:02 pm EST

    You site is dropping the angeled brachet Hierarchy angled bracket
  • Replied 3 August 2017, 4:02 pm EST

    derryt,

    Can you please modify the sample application which I sent so that I can test it at my end? This would actually allow me to see the issue which you are experiencing and I would be able to provide further observations on it.

    Regards,
    Sankalp
  • Replied 3 August 2017, 4:02 pm EST

    Hi Sankal



    Your sample works, and I use the exact same technique as you do in my Project, the only difference being different schema files.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels