Automatically Remove Empty/Deleted Reference Field Entries?
Options
Kyan Lynch
Member ✭
I have several tables with fields referencing entries to other tables. I am now realizing (later than is ideal), that when an entry is deleted in one table, it is not removed from a reference field in another table. Rather, when it is a list-type reference field, a blank entry remains, as seen here:
[Screenshot 2022-09-29 102755.png]This is causing issues in my app, because it looks like there are associated items, but there aren't.
Obviously, I wish that I had added a step to remove reference field entries from other tables when I delete a given record. I can still do that, but it'll take a lot of time. Is there a setting I can enable that will prevent these blank fields from remaining?
[Screenshot 2022-09-29 102755.png]This is causing issues in my app, because it looks like there are associated items, but there aren't.
Obviously, I wish that I had added a step to remove reference field entries from other tables when I delete a given record. I can still do that, but it'll take a lot of time. Is there a setting I can enable that will prevent these blank fields from remaining?
Comments
-
There is not a setting to do this, but it shouldn't be that difficult to do.
You can create a background task to do this and use query all records in stream mode, foreach, and then an edit record. -
Thanks for that suggestion! Makes sense. What query method can I use to find these blank items in a list? Would it be where record.key_words contains ""?
-
you can just use the filter_empty filter. IT will do everything for you and return a new array that has no empty values.
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback