Issue with getting a Donut to display correctly when nested within a Repeater
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2025 03:27 PM
I'm working with a cloned version of the the SOW Service Desk landing page overview SNC option. I want to configure the Carousel > Repeater > Data Visualization with donuts to display the various active records related to Task (incident, change, ritm, etc).
I set up a Data Resource as so:
Table: Task
Filter conditions: Active is True and Assignment Group is dynamic(one of my groups)
Return fields: number, assigned_to, assignment_group, sys_class_name
I then set up the repeater through the bind data option, selected Data resource: <my data resource>results>sys_class_name>value
Now, when I set this up the Repeater in the left hand nav shows 8, which (based on previous work) should mean that I would get 8 separate Donuts. However, I'm getting a "no content to Display. Please add components into the carousel" with a Check mark listed to the left. >.< If I switch the Repeater to go to <my data resource>results, I see 307 on the repeater and then it tries to display all 307 of those donut visualizations and times out because my final state is to have these donuts group by assigned to so I'm assuming it's trying to do that 307 times.
I set up the Donuts using the Bind data option as well:
Data source: <my data resource>results>sys_class_name>value
Metric: <my data resource>results>sys_class_name>display_value
Group By: <my data resource>results>sys_class_name>assigned_to>display_value
I've tried a few different configurations with the selected data resource values but nothing seems to be working. Am I running down the wrong path here? I've found a few youtube explanations, and went through the docs so it seems like it should work and yet, it's not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2025 05:29 PM
When you nest a Data Visualization inside a repeater you need to feed each instance of the chart with its own set of pre-aggregated data. A repeater simply iterates over an array of records; it doesn't group your task list by class or assigned_to. The donut component expects an array of objects with a label and a value; binding the whole task table to it causes the chart to time out.
- Keep the repeater's data source simple. Use an Aggregate API or a Script Data Resource to return just the distinct class names you want. That array becomes the list of items for your repeater.
- Within the item template call another data resource that accepts the class name from the repeater and returns aggregated counts for that class. You can use GlideAggregate or the REST stats API to group by assigned_to.
- Bind the donut component's data property to that aggregated array. The chart does not group records itself; it simply renders whatever series you supply.
Here is an example Script Data Resource:
function getDonutData(className) {
var gr = new GlideAggregate("task");
gr.addQuery("sys_class_name", className);
gr.addQuery("active", true);
gr.groupBy("assigned_to");
gr.addAggregate("COUNT");
gr.query();
var data = [];
while (gr.next()) {
data.push({
label: gr.assigned_to.getDisplayValue(),
value: parseInt(gr.getAggregate("COUNT"), 10)
});
}
return data;
}
In the repeater template call this function with the class name and bind the result to the donut's data property. This ensures each donut only draws counts for its own class and prevents the no content or timeout messages.
💥 Was this answer useful? 👉 If so, click 👍 Helpful 👍 or Accept as Solution ✅ 💡🛠️🧠🙌
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2025 09:22 AM
Thank you @wojasso , this helped tremendously. I'm almost there, I think. I get multiple donuts in the repeater now after applying the aggregate data resource, it's just not loading the data. 😞 It's just spinning on "Loading visualization data".
So, my config now is:
Data Resource: Aggregation Query
Table: Task
Condition: Active is True and Assignment Group is(dynamic(one of my groups))
Group by: Assignment Group
Order by: Number
I set that on the Repeater data array, and it's showing as @data.mc_active_task_record_counts.output.data.GlideAggregate_Query
Within the Donut data section, I set the data sources to the repeater (@item.mc_active_task_record_counts.output.data).
I do see this warning in the donut though: This component is trying to bind to repeater data using @item binding, but it doesn't match any data. Change the property value or select another preset.
Am I still missing a configuration step in the donut? I see the data properly when viewing the source info as I'm building out the repeater and donut connections.