Excuse the beginner question ![]()
Goal is to present counts based on conditions from my Retool DB within a Checkbox Group component.
I'm building an input and checking system for a clothing item database.
An aspect is a checkbox group that allows users to choose which item_type to display.
I want to present a summary of how many of these items there are to check in each category with the intention being this:
Jeans (3)
Jacket (7)
T-shirt (12)
etc.
So this is displaying different item_type items with the status of "Lister Updated" or :"Checker Skipped"
Currently I have an SQL request as follows:
SELECT item_type, status, COUNT(*) as total
FROM listings
GROUP BY item_type, status
and this to Transform Results:
const LABELS = {
"t-shirt": "T-shirt",
"jeans": "Jeans",
"jacket": "Jacket",
"button-up shirt": "Button-up Shirt",
"sweatshirt": "Sweatshirt",
"shorts": "Shorts",
"trousers": "Trousers",
"hoodie": "Hoodie",
"sweater": "Sweater",
"cardigan": "Cardigan",
"knitwear": "Knitwear"
};
const col = data;
const result = {};
const length = col.item_type.length;
for (let i = 0; i < length; i++) {
const raw = (col.item_type[i] || "").trim().toLowerCase();
const type = LABELS[raw] || raw;
const status = col.status[i] || "Unknown";
const total = parseInt(col.total[i], 10);
if (!result[type]) {
result[type] = { "Lister Updated": 0, "Checker Skipped": 0 };
}
result[type][status] = total;
}
return result;
The output from this looks about right:
I'm really struggling to get this to display in the goal format, within the checkbox component or even a text component.
I have this in a text component and it doesn't return anything:
{{ count_listings_by_type["Jacket"]?.["Lister Updated"] || 0 }}
Any help much appreciated, sure it's something simple I'm missing!
Thanks

