I am using custom data api and have issues when fields that are not measures are used as columns. For example here is an example of a multilevel hierarchy of year-month used as column and a single field used as row and while the totals are correctly displayed, no rows appear. I have attached all the requests and pictures related to it. The flexmonster version used is 2.9.82
Hello, Marcelo!
Thank you for reaching out to us.
After examining the provided files, we have noticed that the /select
response is incomplete. In this response, there are no total values for the "Marca" hierarchy that are not crossed with years ("Fecha" hierarchy). In such a case, Flexmonster treats the response as incomplete and does not show these members. For example, here is the set of values that contains the totals only for a year:
{
"values": {
"sale.units_sold": {
"sum": 344719
},
"sale.sales_amount": {
"sum": 40574693000
},
"sale.sales_amount_usd": {
"sum": 43260665.16618464
}
},
"keys": {
"sale.year": "2024"
}
}
To fix the issue with rows not being shown, you should include all the totals for individual companies in the /select
response. The keys
objects should be the same as follows:
"keys": {
"sale.brand_id": "27526"
}
Please let us know if our suggestion helped you to resolve the issue.
Best Regards,
Maksym
Hello, thanks for the response. That seems to do the trick but now I am confused on which are the combinations of rows and columns that I need to group by in the reponse. Let's say in rows I have category, brand and then in columns year, month. I would need to provide totals for all these groups?
Category
Brand
Year
Month
Category, Brand
Category, Year
Category, Month
Brand, Year
Brand, Month
Year, Month
Category, Brand, Year
Category, Brand, Month
Category, Year, Month
Brand, Year, Month
Category, Brand, Year, Month
Hello, Marcelo!
Thank you for your reply.
The list of provided data in the response should match the requested subset of data according to the provided dimensions and filters. In simple terms, the request asks, "How do dimensions provided in the request cross with each other?" and the server returns the data organized in a way that answers that question.
The scenario that you have described, when the data for all fields is queried simultaneously, is possible when the expandAll
option is set to true
. In this case, all fields are expanded immediately upon loading the data. Hence, Flexmonster includes all the available fields in a single request.
When multiple rows and columns are defined without the expandAll
, only top-level hierarchies are visible for rows and columns. Hence, Flexmonster would send the initial /select
request for "Category" and "Year", and you should not return the results for other hierarchies because they are currently not displayed. Then, when the data is expanded or drilled down, Flexmonster would send separate requests for the additional data that should be displayed. These additional requests can be distinguished by the queryType
parameter in the request.
We recommend looking through the requests in the Network tab from this JSFiddle, which is connected to our custom API server. Additionally, you can refer to our GitHub repository, which contains implementations of the custom API server.
Please let us know if our suggestions were helpful.
Best Regards,
Maksym
Understood from the fiddle, thanks a lot!
Hello, Marcelo!
Thank you for reaching out to us.
We are glad to hear that our answer helped you.
Please let us know if more questions arise.
Best Regards,
Maksym