Hi all,
I have spent fews days trying to achieve this, but in vain, opening the challenge to everyone.
I have a denormalised result from an elastic search query, and I have to convert and display it in nested format. I’m wondering if this is possible with any wappler formatters (server or client-side)?
Here is a sample,
[
{ departmentId: "dept1", departmentName: "Finance", name: "John", role: "Analyst"},
{ departmentId: "dept1", departmentName: "Finance", name: "Kate", role: "Manager"},
{ departmentId: "dept2", departmentName: "Helpdesk", name: "Jack", role: "Assistant"},
{ departmentId: "dept2", departmentName: "Helpdesk", name: "Tom", role: "Contractor"}
]
I want to convert this into two-dimensional nested array of objects by grouping like this:
department: [
{
department: "dept1",
departmentName: "Finance",
employee [
{
name: "John",
role: "Analyst"
},
{
name: "Kate",
role: "Manager"
}]
},
{
department: "dept2",
departmentName: "Helpdesk",
employee [
{
name: "Jack",
role: "Assistant"
},
{
name: "Tom",
role: "Contractor"
}]
}]
Wappler pros & gurus, please give me your thoughts on this. Thanks in advance!
Community Page
Last updated:
Last updated: