Changing "AllowCustomValues" for a parameter, based on another parameter

Changing "AllowCustomValues" for a parameter, based on another parameter

casper.vorm
Contributor Contributor
557 Views
3 Replies
Message 1 of 4

Changing "AllowCustomValues" for a parameter, based on another parameter

casper.vorm
Contributor
Contributor

Hi all.

 

I am trying to create a model where users can either select a value from a predetermined list or toggle another parameter to make a "special" version, where they can enter an arbitrary value.

I have made a simple example of what im trying to do:

Sub main
	Dim x As UserParameter = Parameter.Param("param_1")
	If Special = True Then
		x.ExpressionList.AllowCustomValues = True
	Else
		x.ExpressionList.AllowCustomValues = False
	end if
	
End Sub

However, when "special" changes, the parameter is updated but nothing has changed in the form. E.g the property  "AllowCustomValues" is now true, but it still cant be edited in the form, or vice versa.

 

I have attached a simple model that demonstrates my problem.

Thanks in advance!

-Casper

0 Likes
Accepted solutions (1)
558 Views
3 Replies
Replies (3)
Message 2 of 4

A.Acheson
Mentor
Mentor

Hi @casper.vorm 

I havent looked at the attachment so this is just an observation of your initial goal.  This could be a restriction in how the form sees parameters. The form has internal options that are altered when you add the parameter. Can you achieve the same functionality by the manual change of the allowcustomvalues toggle? If you can this can be done by code. If not then that's the limitation of the form/parameter interaction.

 

Wouldn't setting the custom value to true and the user just typing in custom values when needed do the trick for you? The multivalue list is still shown regardless. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 4

WCrihfield
Mentor
Mentor
Accepted solution

Hi @casper.vorm.  The problem in this specific situation is that there is also a similar setting within the settings of that ComboBox within the Form itself, which is also for allowing custom values or not.  And you can not change that value in the Form's settings from the iLogic rule, or from changing that setting of the parameter itself.

WCrihfield_0-1672932318933.png

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 4 of 4

casper.vorm
Contributor
Contributor

Hi again, thank you for your replies.

@A.Acheson Yes, that is an option. In the model I am trying to create, the model have parameters that needs to be computed based on the selected values when special = false. These are computed by some formulas that should only run when special = false, so it would be nice if I could prevent users from typing in that case.

 

@WCrihfield I see, then I will have to find another approach.

 

Thank you for your help!

-Casper

0 Likes