"Trim" an empty string out of existence?
![Brian Giometti](https://us.v-cdn.net/6037124/uploads/userpics/ONIPTIEX0LDD/nJE4ZN6ATNTPB.png)
Is there a filter that I can "trim" an empty string into null or just completely out of existence?
Other than a conditional to handle this and just set the value to null.
Comments
-
Is this string a variable or field in an object?
-
One of things I can think of is to check it with filter is_empty and the use "replace" to turn true into null
-
It's more complicated, but in this case its a field in an object that's getting two other fields concatenated. I just want to set it to null if both of those fields are null, rather than set it to a space (the separator) or empty string (if I apply trim). There are other similar uses I can see for this.
Right now I've just got a conditional after this variable assignment that checks if its an empty string and sets null, but it feels clunky.
One other use I've got that I havent dealt with is pushing parameters to an existing array, but I don't want to push empty strings either. This same (probably non existent) filter would be handy for that too.
-
Ok, so regarding the first thing. I think this should work. update parameter in you object with set_conditional with condition that right now it is empty.
Regarding pushing empty parameters to a list, after you push all of them you can use filter - "filter_empty" to get rid of the empty ones
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