GET default value not seeming to work
Options
![Erin Wagner](https://us.v-cdn.net/6037124/user_avatars/1255328.jpg)
Erin Wagner
Member ✭
Hi!
If I remember correctly, you guys created the GET default value so that--if the pathway didn't exist (because that object didn't have that particular piece of data), we could automatically substitute a new value.[image.png]Unfortunately, it's giving me some trouble in a SPRINTF statement. My test data does not have activity.static_video_chat_url, and it gives me this error:
[image.png]Originally, I thought this error meant I was pulling an array when I needed an object, but after removing every individual piece of data, I was able to determine that this was the trouble maker. No arrays are involved.
Here's the function: https://gomigo.org/admin/workspace/1/function/117
I'll put test data in a comment below.
If I remember correctly, you guys created the GET default value so that--if the pathway didn't exist (because that object didn't have that particular piece of data), we could automatically substitute a new value.[image.png]Unfortunately, it's giving me some trouble in a SPRINTF statement. My test data does not have activity.static_video_chat_url, and it gives me this error:
[image.png]Originally, I thought this error meant I was pulling an array when I needed an object, but after removing every individual piece of data, I was able to determine that this was the trouble maker. No arrays are involved.
Here's the function: https://gomigo.org/admin/workspace/1/function/117
I'll put test data in a comment below.
Comments
-
Test Data:
{
"generate_video_chat_url": false,
"plan_id": 52,
"user_ids": [
303,
319
]
} -
I tried using CONCAT instead of SPRINTF and can see that it didn't input the default value. It's just blank. (But at least it didn't throw an error. I can work with that.)
[image.png][image.png] -
seems like sprintf should work... we'll take a closer look to see what we can find
-
the issue is that your static_video_chat_url does exist, it just is null - rather than not existing at all. So it is using the null value.
For this example, you could use the filter "first_notnull" and pass in an empty string for the 2nd value.
We also will update the sprintf filter to automatically turn null values into empty strings because that is a bit annoying. -
Thanks for both the explanation and the feature tweak. Much appreciated.
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