Get Free Trial

Hide columns but still have the data in getData

Brendan Fry asked on June 12, 2020

We wish to hide a column – I know I can do this with setting id type.
However, this means the data is then not included in the getData events.
Is there some way to hide a column but also have the data come out in the getData events?

3 answers

Illia Yatsyshyn Illia Yatsyshyn Flexmonster June 12, 2020

Thank you for reaching out to us.
Our team would like to kindly explain that the getData API call can only access hierarchies visible in the Field List. Even so, we suggest considering using the workaround demonstrated in the example we have prepared.
It demonstrates the way to hide the specific hierarchy/set of hierarchies from the Field List. As a result, the field is not reachable through UI but is returned by the getData method. The “Color” field is hidden from the Field List in the example, but it is displayed on the chart.
Please let us know if it works for your case.
Our team is looking forward to hearing from you.

Brendan Fry June 17, 2020

Thanks for the response.
I don’t think this will work for us. I cannot provide the slice to the getData function as this will depend on what is in the grid which is user defined. This will continuously change depending on what the user has done to manipulate the grid.
Unless there is some way to get the current slice object, add the additional ‘hidden’ fields we need and provide it to the getData function dynamically.
BTW: We don’t use the getData for charting. 
We use the aggregated data that is linked by ID to other entities in our application.
We want to have this ID in the getData function but not show it in the grid.
In the screenshot we have sales by zone area, the zone id links to an external layout entity. The measures are user defined. We use the data from the grid to highlight/colour our plans. We need this ID but don’t want the users to see it.
Is that possible?
NB: Can provide more detail by email if required.

zone id to hide.PNG

Illia Yatsyshyn Illia Yatsyshyn Flexmonster June 18, 2020

Hello, Brandan,
Thank you for your feedback.
As we can understand, the only reason preventing you from using the proposed approach is the inability to update the slice of the getData API call so that it corresponds to the slice configured by the user.
If so, our team suggests using the following approach, allowing to pass the configured slice to the getData API call, complementing it with a missed identifier.
The current slice can be retrieved using the getReport API call provided by Flexmonster. Next, the identifier needs to be added to columns/rows. Finally, the received slice can be passed to the getData method.
We have modified an example provided earlier so that the slice passed to the getData API call is updated and complemented with the “Color” hierarchy every time the user changes the slice.
Our team would like to draw your attention to the following code snippet taken from the example.
The update method will be executed every time the reportcomplete or the reportchange event is triggered. Such a method is responsible for executing the getData API call.
The first parameter of the getData API call is returned by the getSlice function. In its turn, the getSlice function retrieves the report and complement it with the hidden field.

flexmonster.on("reportcomplete", update);
flexmonster.on("reportchange", update);

function update() {
    slice: getSlice()
  }, function(data) {

function getSlice() {
  slice = flexmonster.getReport().slice
    uniqueName: "Color"
  return slice

Please note that the updateHandler parameter of the getData method should be absent.
Detailed information about API calls and events used in the example can be found in our documentation:

Our team hopes it works for you.
Do not hesitate to let us know if the provided approach does not fit your requirements.
Kind regards,

Please login or Register to Submit Answer