Restrict the value input in Element.SetParameterByName

Is there a way to restrict the possible inputs in the value input of SetParameter node(not just 3 entries but a hundret)? And if for example the value written does not match any of the available ones then show e.g. an error message…?

You’re kind of asking two different questions. You can either 1) restrict the input values so that users can only choose from the given options or you can 2) check values before setting them and return an error for any unwanted values.

Option 1 would likely require Data-Shapes to force the user to select an input value from a list of possible values.

Option 2 would need an If statement to check against the same list of possible values.

With 100 available options an error might actually be easier for the user to handle rather than having to search through so many possible values.

2 Likes

can you enplane more of what you need ? because you cant enter the value as And/Or , this node takes exact values, this mean if you have any process for the value it should happened before using it as an input

Just a thought: Option 2 could use a dictionary and some rounding functions more efficiently than a 100 item deep If statement.

1 Like

@Nick_Boyts & @jacob.small I guess I will go for Data Shapes Dropdown. If the user writes a value that is not wanted in the SetParameter node, this value would still be accepted. Whereas with a dropdown the user is restricted to use one of the given options I propose…:relieved:

So Data Shapes did the work!!! It is also perfectly functionable with Dynamo Player :relaxed:

1 Like

Hey,

If you wanted the user to be allowed to input any string but with a particular set of constraints, you could possibly make use a regular expression checker…

Hope that’s of interest,

Mark

1 Like