Here's the JSON data I'm currently working with:
?$where=camis%20=%2230112340%22
I plan to dynamically generate queries using different datasets, so the information will vary.
My main objective is to categorize elements within this array into distinct arrays based on inspection dates.
For each unique inspection date, I aim to group those specific inspections into their own collections.
- If I had advance knowledge of the dates, I could easily iterate through the elements and organize them into separate arrays.
- Is there a way to create these arrays dynamically?
The ultimate goal is to present each set of inspections (grouped by inspection date) on a webpage using Angular 5. The website is functioning correctly, and all requests are being processed as intended.
Eventually, I hope to achieve a layout similar to this, utilizing the dates received in the response:
2016-10-03T00:00:00
List of inspections
2016-04-30T00:00:00
List of inspections
2016-04-12T00:00:00
List of inspections
Just for reference, here's the snippet of code that I'm currently implementing:
ngOnInit() {
this.route.params.subscribe(params => {
this.title = +params['camis']; // (+) converts string 'id' to a number
this.q.getInpectionsPerCamis(this.title).subscribe((res) => {
this.inspectionList = res;
console.log(res);
});
// In a real app: dispatch action to load the details here.
});
}
I wish I could provide more details at this stage, but my primary focus is getting started on this task.