A simple way to check if an Array is empty?
Options
![Jay](https://us.v-cdn.net/6037124/user_avatars/2364889.jpg)
Jay
Member ✭
I can't for the life of me figure out a simple way to check if an array is empty after getting records which is saved into an array.
Do I really have to separately get array length and separately check if it is larger than or equal to zero?!
Can't I just do a conditional Where Array ≠ Empty? (null doesn't work)
or a conditional Where Array.length ≠ 0?
And I can't even start to figure out if or how set_ifnotempty could be used here but I suspect it can't (or not any simpler than having to add 2 extra lines every time I want to check an array is not empty)
What's silly is that it looks like I can run a get all records twice but the first time use the Return configuration to return the count or true/false if it found anything. Why can't I combine it and return results if they exist and return false or count zero if they don't? (or something like that)
Do I really have to separately get array length and separately check if it is larger than or equal to zero?!
Can't I just do a conditional Where Array ≠ Empty? (null doesn't work)
or a conditional Where Array.length ≠ 0?
And I can't even start to figure out if or how set_ifnotempty could be used here but I suspect it can't (or not any simpler than having to add 2 extra lines every time I want to check an array is not empty)
What's silly is that it looks like I can run a get all records twice but the first time use the Return configuration to return the count or true/false if it found anything. Why can't I combine it and return results if they exist and return false or count zero if they don't? (or something like that)
Comments
-
It looks like this is the solution? [image.png]Damn these Add Filter convention is so unintuitive to me...
-
[Image]
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