Managing Database Errors and Implementing Business Logic Solutions in Xano
The State Changers meeting focused on discussing how to manage and resolve certain data validation issues encountered while using the Xano database system.
A particular issue was raised about the error encountered when a value that doesn't match the pre-defined ones in the database, or enums, was tried to be inserted. The query would error out, and the script would stop.
The speaker suggested managing data quality through business logic rather than relying solely on the database constraints. He expressed a preference for using text fields over enums or other formatted versions of text fields, as these might not cater to user needs effectively, causing errors. Instead, he proposed handling the business logic to regulate the right kind of data without directly involving the database logic.
It was mentioned that to prevent errors while inserting data, it would be beneficial to introduce business logic at the front end, ensuring it validates the data before the database interaction.
Additionally, to handle errors that might occur when inserting data into the database, the utility function 'try catch' was recommended. With ‘try catch’, when an error occurs, the system jumps to the ‘catch block,’ where developers can construct code to handle the error, such as inserting a null value to keep the script running.
Regarding the usage of enums or options dropdowns from a Xano backend, the speaker suggested that these could either be hardcoded in the front end for faster loading if the list isn’t dynamic or fetched from the backend if the dropdown options vary from user to user.
The speaker noted that migrating from Bubble to other tools like Xano and FlutterFlow might involve additional work due to the looser coupling of the front ends and back ends, which could require rework but yield more flexibility.