Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question
1

Change ChoiceArgument parameters based on user input

asked 2019-09-23 10:30:15 -0600

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-09-23 10:52:45 -0600

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

edit flag offensive delete link more

Comments

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

Luis Lara's avatar Luis Lara  ( 2019-09-23 11:10:13 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 2019-09-23 10:30:15 -0600

Seen: 108 times

Last updated: Sep 23 '19