Create custom member filter - Tree

RafMarques
New Contributor III

As we cannot filter the Tree member expansion, is it possible to create a custom Tree?

If not as a custom expansion, perhaps a code that returns a tree i.e. XFTreeItem?

Dimension:

Account

Parent1

    + Member1

    + Member2

        +Member2.1

            +Member2.1.1

            +Member2.1.2

        +Member2.2

            +Member2.2.1

 

In the above account dimension, I dont want Member 2.2. I just want the ultimate Parent1, the next level (Member1, Member2), and all base members. 

The result would be something like:

 

Parent1

    + Member1

    + Member2

            +Member2.1.1

            +Member2.1.2

            +Member2.2.1

 

Thx

 

8 REPLIES 8

JackLacava
Community Manager
Community Manager

Have a look at the .Remove and .List functions in Member Filter Builder, the Samples tab has examples.

If that is not enough, you want to build a Custom Member List. Search in the documentation help for "Finance Function Types" (including double-quotes), pick the first result, then look at the section titled "Member List and Member List Headers", it has example code. You can also look at the Finance Business Rules provided by Standard Reports, there are a few called XFR_MemberList* that provide some practical examples.

Hi Jack,

.Remove and .List do not work in my case, as I would need to know the member name.

The MemberList method works (we use some of them), however, I don't get a Tree style. I wanted to have the same effect as the member.Tree

I managed to present using Top.ChildrenInclusiveR.Base, so I skip some parents after the first level of parents.

Would be nice to have functions to select members by either Generation or Levels.


@RafMarques wrote:

Hi Jack,

.Remove and .List do not work in my case, as I would need to know the member name.

No you don't, you can get that by nesting another expansion. I can't test it but IIRC something like this should work: E#Parent1.TreeDescendantsInclusive.Remove(E#Parent1.TreeDescendants.Where(HasChildren = True).Last)

I agree that we could do with slightly better control of lists though.

Right - I can try that. thx

sudarshan
New Contributor III

Hi Jack,

Not able to nest expressions like this or maybe I'm doing something wrong. Do you have any other alternatives?

Thanks,

Sudarshan


@RafMarques wrote:

The MemberList method works (we use some of them), however, I don't get a Tree style. I wanted to have the same effect as the member.Tree

I forgot to mention, but i'll post it for reference: you can actually get a tree with custom member lists. The key is building the list with MemberInfo objects rather than Member objects; MemberInfo has a property .IndentLevel, which you can explicitly set for each object. It starts at 0, so if you set to 1 for a member, that member will be indented one level; 2 will go one level further; etc etc.

This is actually shown in the Snippet in the screenshot below, but it's a fairly complex one (recurring over the tree, checking for Entity state by period...) so it tends to be overlooked.

JackLacava_0-1689932912056.png

 

Ha! I guess this is what I was looking for. Didn't know we could use Indent here that could affect the result.

So the result of this will be the same as a list of members, but indented in the order I create in the code. It will feel like a "Descendants" style with the members I need, with no expansion (+/-) yeah?

Yeah. I actually picked this as an idea for a blog post, which should be published in the next couple of weeks.