First time here? Check our help page!
1

Change ChoiceArgument parameters based on user input

I am trying to allow a user to select from two dropdowns, but I want the argument of the second dropdown to be filtered based on the input of the user in the first dropdown. A simplified example would be:

states_hash = ['Texas' => ['red', 'blue'], 'Oklahoma' => ['green', 'purple']]

# adding argument for state
state = OpenStudio::Measure::OSArgument.makeChoiceArgument('state', states_hash.keys, true)
state.setDisplayName('State')
state.setDefaultValue('Texas')
args << state

# adding argument for color
color = OpenStudio::Measure::OSArgument.makeChoiceArgument('color', states_array[state], true)
color.setDisplayName('Color')
args << color

The first argument computes fine, but for the second one, states_array[state] is empty because (I believe) that when the measure loads, state is nil. Any ideas?

Luis Lara's avatar
2.1k
Luis Lara
asked 2019-09-23 10:30:15 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

Dynamic measure arguments aren't supported: https://github.com/NREL/OpenStudio/is...

ericringold's avatar
10.6k
ericringold
answered 2019-09-23 10:52:45 -0500
edit flag offensive 0 remove flag delete link

Comments

Unfortunate, they would be really helpful in the PAT. Thanks!

Luis Lara's avatar Luis Lara (2019-09-23 11:10:13 -0500) edit
add a comment see more comments