Hello, Bubble Community!
I’m working with the API Connector to fetch attendance data for multiple employees, and I’m on the Starter plan. The API returns the following JSON format:
{
“result”: [
{
“attendanceDetails”: {
“2024-08-26”: {
“ShiftStartTime”: “12:00 AM”,
“Status”: “Janmashtami(Holiday)”,
“TotalHours”: “00:00”
},
“2024-08-27”: {
“ShiftStartTime”: “12:00 AM”,
“Status”: “Present”,
“TotalHours”: “08:56”
}
},
“employeeDetails”: {
“mail id”: “hidden”,
“first name”: “hidden”,
“last name”: “hidden”
}
},
{
“attendanceDetails”: {
“2024-08-26”: {
“ShiftStartTime”: “12:00 AM”,
“Status”: “Janmashtami(Holiday)”,
“TotalHours”: “00:00”
},
“2024-08-27”: {
“ShiftStartTime”: “12:00 AM”,
“Status”: “Present”,
“TotalHours”: “09:25”
}
},
“employeeDetails”: {
“mail id”: “hidden”,
“first name”: “hidden”,
“last name”: “hidden”
}
}
]
}
I would like to store this data into my Bubble database, in a table with the following fields:
- Date
- Employee’s email
- Total Hours
- Status
The idea is to:
- Store the data for each date and employee (coming from the API’s
attendanceDetails
andemployeeDetails
). - Prevent duplicate entries: If data for a specific date and employee already exists in the database, skip adding that entry.
I’ve already connected the API and can pull the data, but I’m struggling with the logic to iterate over each employee and their dates, and then check for existing records before saving new ones.
Can someone guide me on how to set up the workflow to achieve this?
Thank you in advance for your help!