Number - Min Max
# 🤝help
h
Whats the purpose of the min, max fields in the Number type variable. They dont seem to do anything. Doesn't do validation. Doesn't cause any failure. If I want to confirm a value is between 1 and 10 it seems I have to create validation code entering the minimum and maximum values manually. A little confused here.

https://cdn.discordapp.com/attachments/1133261816907173928/1133261817041387520/image.png

r
I'm wrestling in this area too. The variable can have a range, and there is validation on the capture card that may or may not be looking for the same range. There is a validation failure message and a retry message which I would expect to both display if both are defined but they don't. And I haven't gotten my validation on my Number capture card to work consistently. Is that supposed to do anything besides throw an error, which only shows in the logs? If validation throws an error what should happen with the flow? So I'm just lost with how we should be enforcing a numeric range.
bump ( is that a thing in Discord? ) 🙂
h
Hey @bumpy-butcher-41910 Can you help us out here?
@acceptable-kangaroo-64719 Maybe you can help us?
a
I hadn't realized that you could set min/max values on numeric variables 😅 ya learn something new every day. Anyways, this is how I would enforce a range upon a variable. I would use the capture card, set it to number, and then put a validation of
return input >= 1 && input <= 10
to enforce the range.

https://cdn.discordapp.com/attachments/1133261816907173928/1134439405461966898/image.png

https://cdn.discordapp.com/attachments/1133261816907173928/1134439405738786898/image.png

https://cdn.discordapp.com/attachments/1133261816907173928/1134439406007238728/image.png

h
Thanks @acceptable-kangaroo-64719. If the min/max fields do nothing, maybe remove them to avoid confusion. The default field is needed. The validation code you provided is not working for me, if I enter a value above the maximum I don't get a validation message and it tells me that I chose 0 (which is the default value). If I change the default value to 12 and enter 100, it tells me I have chosen 12. Not sure what's going on here.
a
There might be a bug with validation. I just tried it a few times on my side and the bot said that 19 was between 1 and 10....
However doing the logic in transitions is proving more reliable. In my case, I just have the card extract a number and save it to workflow.num, then my transition is for
workflow.num >= && workflow.num <= 1
. The downside of this is that we have to manually do stuff like retries, too.
h
Can you report this possible bug please or is there somewhere I can.
a
yes it has been reported internally 😄
3 Views