Empty "" text is considered null? Why?
Options
Kevin Wasie
Member ✭
If I use the following JSON input, Xano considers the name [text] field to be null. Why?
{
"id": 1,
"name": ""
}
In other programming languages, I can set a variable to be = "", and this is different than null.
I'm attempting to keep or edit the value of a text db field. If the user clears the data on the front end, the input field will be "". I need to check the input for null value, and if it's null, then keep the current value in the db.
first_ifnotNull does the same thing.
{
"id": 1,
"name": ""
}
In other programming languages, I can set a variable to be = "", and this is different than null.
I'm attempting to keep or edit the value of a text db field. If the user clears the data on the front end, the input field will be "". I need to check the input for null value, and if it's null, then keep the current value in the db.
first_ifnotNull does the same thing.
Comments
-
Hey
I don't think it is since we have a lot of people doing exactly what you are trying to do.
Can you provide more details? Screenshots? Also a link to your endpoint would help as well.
You can send this via support as well if you want it private. -
thanks for responding. Here is what I'm referring to:
-
Your input is set to not nullable.
Right at 17 seconds. That that option to nullable and it will do what you want. -
I tried that. I also tried removing the trim filter. Neither of which changed the result.
-
Ah gotcha... its because its a == comparison and not a === comparison.
You can use the is_null filter to do what you want.
[download.jpg] -
Thank you!
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