narnia649
narnia649

Reputation: 381

How do you create a link to a Option List with different set values in AnyLogic?

I created an "Option List" & parameter with that data type in "Main" with three different options (A, B, & C). Additionally, I set the "Control Type" to "Radio Button" and defined the List of values.

Now, when I go to "Simulation" I want to have a radio button in the view that the user can select. When that selection is made and the simulation is run, the simulation would use the selected value.

The problem I am having is how to use the "Link to:" option to link this to the "Option List" parameter defined.

I created a "variable" in the "Simulation" view with the correct "Option List" data type, but the radio button won't let me "Link To" that particular variable.

How do you set up the "Link To" to point & change the "Option List" defined in Main?

Upvotes: 0

Views: 227

Answers (1)

narnia649
narnia649

Reputation: 381

Nevermind, I was able to resolve this by using a collection object within "Simulation" that defines the three options in the "Option List".

Then, inside the simulation for that parameter I used the following code: dataOptions.get(radio.getValue())

Now, when the radio button changes an integer gets sent to the dataOptions collection and sends the correct Enum value.

Upvotes: 1

Related Questions