Hey @tomm ,
I understand your question, and I went ahead and created the same mock structure of your data based on your explanation.
First, I prepared a transformer with mock data:
return [
{ id: 1, employee: "Alice", task: "Report preparation", date: "2025-08-03", weekNumber: 1 },
{ id: 2, employee: "Bob", task: "Client call", date: "2025-08-05", weekNumber: 1 },
{ id: 3, employee: "Charlie", task: "Code review", date: "2025-08-09", weekNumber: 2 },
{ id: 4, employee: "David", task: "Database update", date: "2025-08-12", weekNumber: 2 },
{ id: 5, employee: "Ella", task: "Testing", date: "2025-08-17", weekNumber: 3 },
{ id: 6, employee: "Frank", task: "UI design", date: "2025-08-20", weekNumber: 3 },
{ id: 7, employee: "Grace", task: "Deployment", date: "2025-08-23", weekNumber: 4 },
{ id: 8, employee: "Hannah", task: "Documentation", date: "2025-08-26", weekNumber: 4 },
{ id: 9, employee: "Ian", task: "Meeting notes", date: "2025-08-30", weekNumber: 5 }
];
Then I stored these values inside a variable so I can reference them easily with:
{{ mockData.value }}
Next, I created a JS query for inserting new records dynamically. This query automatically calculates the week number, finds the last ID in the dataset, and appends a new record with lastId + 1
:
const newDate = new Date("2025-08-27");
const day = newDate.getDate();
const weekNumber = Math.ceil(day / 7);
// current dataset from state
const currentData = monthlyDataState.value || [];
// find the last id (if no data, start from 0)
const lastId = currentData.length > 0
? Math.max(...currentData.map(r => r.id))
: 0;
// new record with lastId + 1
const newRecord = {
id: lastId + 1,
employee: "Eliza",
task: "Testing",
date: "2025-08-27",
weekNumber
};
// update state
monthlyDataState.setValue([...currentData, newRecord]);
return newRecord;
With this setup, I can add data statically into the array to simulate records, and it updates my state variable automatically.
For the tables, I set the data source to filter records by week number. Example for Week 1 table:
{{ monthlyDataState.value.filter(r => r.weekNumber === 1) }}
I repeated the same setup for Week 2 through Week 5, so each table only shows tasks belonging to its respective week. Whenever I run the insert JS query, the new record is added to the state and automatically reflected in the correct weekly table based on its week number.
This way, I can easily simulate adding new data while keeping the weekly breakdown structured across multiple tables.
I’ve also attached some screenshots and a screen recording to demonstrate how it works in action:
And in a dynamic way, you can add an event handler on your get query and set the data response in a variable, then filter it into tables the same way I did. Also, on the insert query, add a success event handler to trigger the get query — this way, the new data will automatically store into the variable and update the tables without refreshing any table manually.