Environment Variable as Default Value?
Options
![Georges Duverger](https://us.v-cdn.net/6037124/user_avatars/1709796.jpg)
Georges Duverger
Trusted Xano Expert ✭
Just to confirm an assumption I'm making: there is no way to reference an Environment Variable as the Default Value of an input, correct? I'm using the same default value in a few endpoints and I was hoping to have the option to change them all in one place.
[environment_variable_default_value.png]
[environment_variable_default_value.png]
Comments
-
using the environment variable there is not supported currently.
I would recommend setting that input to nullable and then any time you reference that variable, you can use the "first_notnull" filter and put the environment variable in there.
Or if you use that input in a lot of places, then switch to a variable at the top so you only do the filter one time.
var days = input:days|first_notnull(env:default_days) -
Oh, that's a good solution. I'll give it a try. Thanks.
-
I wasn't able to use the first approach because the place where I need to use that default value doesn't allow for a filter. I guess it's because I'm already in a filter (see screenshot).
[no-filter-available.png]
That said, the second approach of creating a variable at the top with the `first_notnull` filter worked well. 💪 -
ah... yea the SQL filters aren't as flexible yet as the standard function stack filters. The UI looks the same but it's different engines behind the scene. We'll get there though!
Glad the 2nd option worked.
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