Fixed set of values as dropdown inputs

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Submitted by vinayak on Thu, 01/21/2016 - 23:59 

I want to know if there is a way to input pre-selected values as inputs similar to drop down menus. Example> if I want to ensure user can input only one of the pre-selected values e.g., 0,25,50,75,100 , but no other values how can I do it? Secondly> if I want to name these values such as NONE, QUARTER, HALF etc. which when selected will input corresponding numeric value, how can I do this in a model? Thanks, Vinayak

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2020

    Submitted by pete on Fri, 01/22/2016 - 01:22.

    You need to use dialogConstant blocks like this one: dialogConst.png . It is under Blocks > Signal Producers.
    Right click the block to set it up as a dropdown (integer list):

    dialogConst-properties.png

     

    The output of the dialogConstant block will be the ordinal value of the selected item in the list.
    The topmost item has value 0.
    To transform the list index value to other values, use a case block as below:

     

    dialogValMap.png

     

    To see your dialogConstant dropdown along with other dialogConstants in a dialog box, encapsulate all the dialogConstants and associated blocks into a Compound block. Ctrl + right click on the Compound and select 'Create Dialog from Contained Dialog Constants' as below:

     

    dialogConst-CompoundProperties.png

     

    When the user right clicks on the compound, The following custom dialog containing all dialogConstant blocks will appear. We added one more dialogConstant block for 'Test Duration'. See below:

     

    RtClickToCustomDialog.png

     

    If you are signed in, you can download the example diagram used for the above screen shots by clicking the attachment below.

    Unable to find an attachment - read this blog