Hi all,
Just wondering if it's possible to add a maximum and minimum to an integer. I am currently using numbers 1-3 for visibility parameters, and would like to cap it to those numbers.
Thanks
Hi all,
Just wondering if it's possible to add a maximum and minimum to an integer. I am currently using numbers 1-3 for visibility parameters, and would like to cap it to those numbers.
Thanks
Hello @phillipesfy_ ,
You need to use a second parameter that will constrain the values of the first one. That second parameter is the one that you will use for your object while keeping the first one as a input.
So, let's say your input parameter is named VisibilityInput, then you would need another one that you could call VisibilityInputConstraint. Then VisibilityInputConstraint will be have a formula that would look like this :
if(VisibilityInput < 1, 1, if(VisibilityInput > 3, 3, VisibilityInput))
And like that, VisilibtyInputConstraint will always be between 1 and 3 and you will be able to use it to have values that are constrained between the minimum and maximum you want.
I would advise to have your minimum and maximum values as parameters as well so you do not have to hardcode them into the formula above.
if(VisibilityInput < VISIBILITY_MINIMUM, VISIBILITY_MINIMUM, if(VisibilityInput > VISIBILITY_MAXIMUM, VISIBILITY_MAXIMUM, VisibilityInput))
But that would also require you to have two additional parameters in your list so it's up to you and how many more parameters you're fine with.
Hello @phillipesfy_ ,
You need to use a second parameter that will constrain the values of the first one. That second parameter is the one that you will use for your object while keeping the first one as a input.
So, let's say your input parameter is named VisibilityInput, then you would need another one that you could call VisibilityInputConstraint. Then VisibilityInputConstraint will be have a formula that would look like this :
if(VisibilityInput < 1, 1, if(VisibilityInput > 3, 3, VisibilityInput))
And like that, VisilibtyInputConstraint will always be between 1 and 3 and you will be able to use it to have values that are constrained between the minimum and maximum you want.
I would advise to have your minimum and maximum values as parameters as well so you do not have to hardcode them into the formula above.
if(VisibilityInput < VISIBILITY_MINIMUM, VISIBILITY_MINIMUM, if(VisibilityInput > VISIBILITY_MAXIMUM, VISIBILITY_MAXIMUM, VisibilityInput))
But that would also require you to have two additional parameters in your list so it's up to you and how many more parameters you're fine with.
I had similar formula that works with lengths but it should work integers as well. Check the screenshot
I had similar formula that works with lengths but it should work integers as well. Check the screenshot
Can't find what you're looking for? Ask the community or share your knowledge.