How can I group data for one to many relationship?
In our project, we would like to have data from table with one to many relationships. I.e one record in the application has more than one specific field – One order has 2-3 suppliers. Is it possible to display how many suppliers has each order?
Thank you for writing to us.
We would like to kindly explain that the possibility to visualize such a data set using WebDataRocks depends on the way the actual data is represented.
Therefore, our team would like to kindly ask you to provide us with information about the data source you use (JSON or CSV) and the way such relationships are represented in your data sets (for example, an array of suppliers as a value of an appropriate object’s property for JSON, or comma-separated suppliers wrapped with brackets for CSV).
The mentioned ways to specify one to many relationships are not supported by the component. Even so, it is possible to preprocess the data in the way it is represented in an appropriate form. For example, instead of including all suppliers as elements of an array, it is possible to create several records for one order each of which includes a unique supplier:
suppliers: ["supplierA", "supplierB"]
Please see an example demonstrating the described approach.
We are looking forward to hearing from you.