Forum Discussion

saifsafwan's avatar
saifsafwan
New Contributor
2 days ago

FilterMembers syntax (: vs ,) and base clearing when using GetDataBufferUsingFormula

I’m working on a custom clear process that clears cube data using GetDataBufferUsingFormula() 

The goal is to dynamically clear data for all base members under the current POV (Entity, UD1-UD4) by expanding any parent members with the .Base suffix.

In other words, I want to make sure every dimension in the POV (Entity and UDs alike) is ultimately resolved down to base members before the clear runs.

Here’s a simplified idea of what I’m doing:

Dim filterString As String = String.Join(":", intersectionParts)
Dim fullFilter As String = $"FilterMembers({filterString})"
Dim sourceBuffer As DataBuffer = api.Data.GetDataBufferUsingFormula(fullFilter, DataApiScriptMethodType.Calculate, False, destinationInfo)

The process builds a FilterMembers() expression dynamically, retrieves the buffer, and sets all cell amounts to zero to perform a clear.

However, I’m facing two issues:

  1. Some child members aren’t being cleared, even when I use .Base on their parent.
  2. I’m not fully sure about the correct syntax for FilterMembers, should the dimensions be separated by colon (:) or by comma (,)? What’s the real difference between the two, especially when dealing with multiple parent members or nested intersections?

For example, if I have three parent members in my intersection, I might build something like:

FilterMembers(E#MyEntity.Base:U1#ProfitCenter.Base:U2#Location.Base)

But it’s unclear whether that colon syntax is correct, or if it should be comma-separated, or another thing is, the use of square bracket...since some base-level data doesn’t seem to clear.

Could this be a syntax issue with FilterMembers, or could the problem come from how I’m constructing or passing the intersection into GetDataBufferUsingFormula()?

Any clarification or working example for multi-parent .Base expansions with FilterMembers() would be a huge help.

Thanks in advance!

2 Replies

  • Hello Saifsafwan,

    Long story short, the ":" is used to define the general POV of the get-databuffer you want and the other terms separated by "," are the detail you want. Also, the entity dimensin belongs to the data unit so it's better not to mention it explicitly in the calculation.

    In the example below, the common members are defined and fixed (O#Top:I#Top:U3#Top:U4#Top), then you ask for the detail you need (U1#ProfitCenter.Base , U2#Location.Base). 

    Also, during testing you can log the databuffer to know exactly what you're selecting and try to use the "RemoveZeros" function.

    Example: FilterMembers(O#Top:I#Top:U3#Top:U4#Top, U1#ProfitCenter.Base , U2#Location.Base).

    Regards

  • (complement)

    Concerning your question 1, check on the extensibility. It could happen that you have other members on the merged dimension so you're not going to the right ".Base" member expansion. You can use 

    "Base.Options(Cube= cubeName, ScenarioType=ScenarioTypeName, MergeMembersFromReferencedCubes=False)" 

    to get the right level of "base" you need according to cube and scenarioType.

    Regards,

    Carlos