We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.

Get all sibling dimensions of selected cell (header)

Resolved
Accobat Development asked on April 3, 2023

Hello,
We have a use-case where we have to get all siblings of a selected column- or row-header. By "siblings" I mean every header that is on the same level. So for example the column layout:
 
Year

>> Month
>> >>> Week

In this instance selecting "Year.[2013], Month.["January"]" I want to have a list of all cells that are a month. Essentially a list of all column headers in the set that contain:
Year.[XXXX], Month.[XXXX]
I reckon it is possible to make a workaround wherein we get the data of the selected header cell and then filter through all of our reportData for instances that contain both year and month (but not any other columns). However, this would be relatively resource intensive and I want to know if there's an easier way of doing it in FM.
 
I have tried implementing this solution, as every sibling dimension should have the same rowIndex (in the case of columns, at least. With rows we can just check their level property).
https://www.flexmonster.com/question/how-to-get-selected-full-row-data/
However, this solution has a fatal flaw in the fact that FM does not render data that is not shown on the screen. This means that in data-sets that exceed the window, any column not shown will not be included in the query.
 
Thank you for your help
 
Br,
Jonas

5 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster April 4, 2023

Hello Jonas,

Thank you for reaching out to us.

Could you please provide us with more details on your use case? How do you want to use the sibling dimensions of the selected cell? It would greatly help us.

Looking forward to hearing from you.

Kind regards,
Nadia

Public
Accobat Development April 4, 2023

Essentially we have implemented a functionality that allows our users to create their own dimensions. In a manner similar to Excel, they have the option to create formulas based on other dimensions. Let's use the previous example:

> Month
>> >>> Week

 
Our users could make a new column next to the other month columns. Let's say they place it after March so their columns are essentially:
 
[Jan, Feb, Mar, CustomColumn, Apr, May, ...]
 
They may want to set CustomColumn's contents to be Jan+Feb+Mar, for example. This allows users to create their own visuals on the fly. 
 
Now, we are making a UI for this feature. One of the limitations of this feature is that users can only add dimensions that are siblings to their custom dimension to their calculations. So the calculation Jan+Feb+2014 would not hold. Neither would Jan+Week2+Mar.
 
To create a better user experience we are implementing a selection/search combobox in our UI using the React-Select package. This is essentially a sort of drop-down menu from which users can select options. We want this to be populated with the appropriate dimensions that the user can implement in their calculations. This happens to be every sibling dimension of the custom column. In our UI, you select the custom column by selecting the header of it, thereby making it the selectedCell.
 
So in this example the drop down should contain: [Jan, Feb, Mar, Apr, May, ...]. It should NOT contain any dimensions on the parent-level nor the child-level. We have a workaround going for columns right now, but we are really not happy with it. Its drawing from the tableSizes property (as we have all column tuples stored there, rows is still a WIP). We mostly consider this a temporary solution until you can give us a lead or we can find something better ourselves 🙂
Ideally, these sibling tuples should contain information on their ancestry as well. [Jan, Feb, Mar, Apr, May, ...], for example, may appear several times. It's important for us that we are able to distinguish between 2013.Jan and 2015.Jan.Especially in the case of asymmetric dimensions.
 
I have attached an image of the UI to give you something of an idea.
 
 

Attachments:
CustomDimensions.png

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster April 5, 2023

Hello,

Thank you for the detailed explanation.

Kindly note that the recommended way of retrieving data from the Flexmonster component is using API calls. You can use the getMembers API call to return a list of members for the specified hierarchy. It returns an array of objects with member's caption, uniqueName hierarchyName, children, isLeaf, and parentMember properties. 
You are welcome to check the following JSFiddle for reference: https://jsfiddle.net/flexmonster/y63xn1tv/ 

Please let us know if this approach works for you. Looking forward to hearing from you.

Kind regards,
Nadia

Public
Accobat Development April 5, 2023

Hi Nadia,
 
Thanks for the explanation of getMembers. I had tried using it a bit for experimentation earlier but couldn't produce meaningful results. Since you suggested it, I will look further into it and see if we can't use it to make a function that returns the selectedCell's siblings.
I'll consider this case closed. If we encounter further issues in this matter I may open it again. Until then, I wish you well 🙂 
 
Br

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster April 5, 2023

Hello Jonas,

Thank you for the feedback.

Sure, you are welcome to reach out to us in case further questions arise. 

Kind regards, 
Nadia

Please login or Register to Submit Answer