Need a special offer?Find out if your project fits.
+

Custom Datasource Api - Filtering Calculated Values

Answered
Henry asked on January 25, 2021

Hello,
 
When we use the Custom Datasource Api, how do we handle cases when a Report Filter is applied to a "Calculated Field"? I was inspecting the network in the demo and noticed that if I created a calculated value and attempted to apply a report filter to it, the demo responds with an "Internal Server Error" on the /select request. It is to my understanding that the Custom Datasource Api can only handle fields that itself already knows, not fields that were created by users via "Calculated Values." If this is the case, how do we handle a /select request that involves a field that was created by "Calculated Values"? Attached is a fiddle to for ease of replication, I've left comments in the html, but in case they get malformed:

  • jsFiddle
    1. Click on the COLOR Report Filter
    2. Filter by: Values
    3. Switch the value from Sum of Price to My Calculation
      • Optionally change the filter condition and filter value
    4. An error occurs on the /select request, presumably because My Calculation is not a known
      field by the server that implements the Custom Datasource Api

Kind regards,
Henry

8 answers

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster January 26, 2021

Hi Henry,
 
Thank you for reporting this.
 
Our team will take a look at the issue in question and do some research on what can be done here. We'll return to you with updates on ETA Feb 22nd.
 
Please let us know in case there is anything else we can help you with in the meantime.
 
Best regards,
Mykhailo

Public
Henry January 27, 2021

Hi Mykhailo,
 
Sounds good! I just noticed I had a small typo in the original question - Step 1 should read "Click on the COLOR Column." Apologies for any confusion this may have caused.
 
Kind regards,
Henry

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster January 27, 2021

Henry,
 
Thank you for the heads up – no worries!
 
Regards,
Mykhailo

Public
Henry February 3, 2021

Hi Mykhailo,
 
Thought I'd give a quick update - this might be related to a question I have posted. In our implementation of the Custom Datasource Api, we noticed that if we ignore "Calculated Values" in /select requests, e.g., when filtering, the pivot table is able to filter the calculated values for us as long our implementation processes everything within the request that is not a "Calculated Value." Is this the intended and/or recommended implementation for handling requests with "Calculated Values"?
 
Kind regards,
Henry

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster February 4, 2021

Henry,
 
Thank you for sharing your observation with us!
 
We're happy you've found a workaround that works for you. What happens is when the custom data source API server receives a /select request without the calculated value, the formula calculation for filtering is handled by the client-side instead, therefore eliminating the problem altogether.
 
Feel free to use this approach for now – our team will consider this when carrying out the research.
 
We'll keep you posted.
 
Best regards,
Mykhailo

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster February 23, 2021

Hi Henry,
 
Hope you're doing well.
 
We've done some research and encountered a couple of technical limitations that would make it problematic to implement proper filtering by calculated values with the current pivot table architecture.
 
With that in mind, we are currently considering removing calculated value filters from the UI altogether.
 
Before forming our decision, we wanted to check with you whether you encountered the initial bug by accident or if filtering by calculated values is something you are planning to use frequently.
 
Could you please give us some insights on that?
 
Thank you in advance and looking forward to your response
 
Best regards,
Mykhailo

Public
Tom Ray February 23, 2021

Hey Mykhailo,
 
I am not aware of anyone filtering on a specific calculated value but it seems like something that I could see people using i.e. rows where individual values > .5   That being said we are fine either way.
 
Tom

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster February 24, 2021

Hi Tom,
 
Thank you for your response.
 
In this case, we will most likely be removing this functionality from the pivot table for now until a better solution comes up.
 
As always, feel free to reach out in case there is anything else we can help you with.
 
Regards,
Mykhailo

Please login or Register to Submit Answer