How can we group rows in Readonly grid
Discussion posts and replies are publicly visible
You can group the data before passing it in DB or in expression.Or You expecting something different?
assume that I have a field - Job Type for that field I have values Software for 2 rows then I need group that two rows into single row
You have to aggregate data.Hope you are expecting similar..
a!localVariables( local!employees: { a!map(name: "John", jobType: "Software", salary: 50000), a!map(name: "Sarah", jobType: "Software", salary: 60000), a!map(name: "Mike", jobType: "Testing", salary: 45000), a!map(name: "Lisa", jobType: "Testing", salary: 55000), a!map(name: "Tom", jobType: "Management", salary: 70000), a!map(name: "Emma", jobType: "Management", salary: 65000) }, /* Get unique job types */ local!uniqueJobTypes: union(local!employees.jobType, local!employees.jobType), /* Aggregate data by Job Type */ local!aggregatedData: a!forEach( items: local!uniqueJobTypes, expression: a!localVariables( local!currentJobType: fv!item, local!filteredEmployees: a!forEach( items: local!employees, expression: if(fv!item.jobType = local!currentJobType, fv!item, null) ), local!validEmployees: reject(fn!isnull, local!filteredEmployees), a!map( jobType: local!currentJobType, employeeNames: joinarray(local!validEmployees.name, ", "), totalSalary: sum(local!validEmployees.salary), employeeCount: count(local!validEmployees) ) ) ), a!gridField( label: "Employees Grouped by Job Type", data: local!aggregatedData, columns: { a!gridColumn( label: "Job Type", value: fv!row.jobType ), a!gridColumn( label: "Employees", value: fv!row.employeeNames ), a!gridColumn( label: "Count", value: fv!row.employeeCount ), a!gridColumn( label: "Total Salary", value: fv!row.totalSalary ) } ) )
Make use of aggregation in the queryRecordType(). You can use a!aggregationFields() when defining the fields for querying the record.