Hey there! In this post, we'll dive into Xano's latest feature - four new filters designed to streamline your business logic and remove the need for complex conditional statements. These filters are especially handy when you're editing records or objects and want to update specific fields only if they're not empty or null. Let's get started!
Imagine you're working with a `products` table, and you want to update a record's fields like `name`, `description`, and `price`. Previously, you'd need conditional statements for each field to only update if the input value wasn't empty or null. But with Xano's new filters, you can kiss those conditionals goodbye and keep your function stack clean and tidy.
Here's how it works:
That's it! Now, when you run the endpoint, Xano will intelligently update only the fields that have non-empty (or non-null) input values, leaving the rest untouched.
These filters shine when updating objects too. Let's say you have a `product` object, and you want to update its properties (`name`, `description`, `price`) without overwriting existing values with empty or null inputs.
Here's how you can leverage the `Set If Not Empty` and `Set If Not Null` filters:
By following these steps, you'll ensure that only the object properties with non-empty (or non-null) input values are updated, preserving the existing values for the rest.
These new filters are game-changers for streamlining your business logic, making your function stacks more readable, and simplifying the process of updating records and objects conditionally. Give them a try and see how they can supercharge your Xano workflows!
This transcript was AI generated to allow users to quickly answer technical questions about Xano.
I found it helpful
I need more support