How to provide grids in Dropdown field

Is it possible to provide grids in dropdown field-

the names of the grids should be mentioned in dropdown and when user selects the name of the grid then that grid should be visible to the user. Also if this method is not possible please suggest any other alternative for this requirement.

 

  Discussion posts and replies are publicly visible

  • Yes. If you make your dropdown choice values an array of number (integers), they each could correspond to a specific grid on your interface. You could use the choice value to navigate between grids using a choose statement: choose( value , grid1(), grid2(), grid3()). In this case, value = 1 would show grid1 and so on.

    There are likely more elegant solutions, but this would get the job done.
  • At first it sounds a little like you are attempting to display a grid within the confines of a Dropdown widget. As far as I know this is impossible and also not recommended.

    If you are stating that you would like to display one grid or another based on the choice made in a Dropdown, yes this is doable and in fact a very good design pattern.

    Two good means of showing items conditionally are choice() and if().

    choose( ri!dropdown_value

    1: rule!grid1(),
    2: rule!grid2(),
    3: rule!grid3()
    )

    or

    if ( ri!dropdown_value = 1, rule!grid1(), rule!grid2() )

    For the sake of succinct and readable code, my suggestion would be to implement each grid in a separate rule, and use the conditional functions to decide which of the rules you will call based on what was chosen in the dropdown. This will also make your code very easy to maintain and update should requirements change.