Inputs - API or Functions - Default Values
Options
![Daniel Rjeili](https://us.v-cdn.net/6037124/user_avatars/1510658.jpg)
Daniel Rjeili
Member ✭
I would like to understand the use of "default values" ... for e.g. I have a function with a Input testValue, I set DEFALT VALUE e.g. "123" when a call the function returns empty value .... so what is the use of this "DEFALT VALUE"? (In my case if this works as I thought, returning "123", would awesome and reduce a lot of consistence checks and procedures ) Thanks in advance! ... if it is just "informative" for documentation... would be very good have a simple filter to set a "defaultvalue_ifempty" 😂
[image.png]
[image.png]
Comments
-
check out the set_ifnotnull, set_ifnotempty, and set_conditional.
Those all work with a path or an empty path, so it can do exactly what you are explaining. If the path is empty, then it replaces the entire value. -
but its not about the path, its just about pure variable value as it is ... what I am suggesting when you configure the input variable there is no filter option for set default value
[image.png] -
- Sorry but I'm not following you. There is a default value - I can see it in your own screenshot on the left.
-
, yes there is a Default Value field when you configure the input, but I tried to set this value e.g. for "123" ... then I run debug to see if in the flow of the function stack this input testValue and was empty. thats why I asked "what is the use for this "Default value field"
-
I made a quick loom video - check it out and let me know if this clears things up. https://www.loom.com/share/62581f801188420ab1768ab9f91cec90
-
now clarified the understanding about the "default value", only when it is not informed (nonexistent) it is assigned. I was thinking when the input value was null, but you're absolutely right null still is a value. It was a mixture of lack of understanding on my side about how the "default value" works, with a try of "shortcut" to me don't need to consist the data informed in the function stack with a statement: "if ( testValue = null) then ... else ... ". Thank you very much for the video !!!
-
I just noticed a subtle bug in the run&debug... required means needs to be present and non-empty.... this will be fixed in the release tomorrow.
The API enforces that but the run&debug was slightly different. -
so my doubt in other side was useful to identify this. Virtuous cycles 😊👍👍
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