How to link an SQL-query to a dropdown widget?

I have a school project where I need to add players using a form. In the form I need to have a "position" field with which I can choose an option from a dropdown menu. I am asked to:

  • create new data structure and store player positions in the new structure
  • use SQL-query to get the list of all possible player positions and display the contents of the list in position drop-down list

I created  a query but I still didn't figure out how to "link it" to the dropdown menu. Any help would be much appreciated!



Hello Basil, 

You are missing a few steps to be able to select from your list. 

First, you have to assign the Out value of your action to the result of your SQL:

Then you can use that Out parameter as a source on your drop-down :


I will attach an oml with a solution so you can take a look.

Hope it helps! 

Paulo Rosário

OptionsDrop.oml

It worked thanks alot!!

I need to create "Position" data structure that is in place of "Options" in your solution. The "Position" is a column in a table and not a table itself. Also I noticed that when I add a new player the position field in the database table is empty maybe null? Any idea how I can fix it.  I attached a copy of my project. If you have time can you take a look at it? Again I appreciate your help.

ProjectWork.oml

Hi Basil,

Here's your module with the necessary changes. An overview of what I've done:

  1. Created new "Position" entity. I've created it as a static entity, but if you need to allow users to manage the positions themselves, you need to create it as a regular entity and then create the UI to manage it.
  2. Changed the data type of the Player.Position attribute from "Text" to "Position Identifier". That is, a reference to the new entity created above.
  3. Replaced the "GettingPositions" data action in the "AddPlayer" screen with a simple aggregate to fetch the records.
  4. Changed the dropdown's properties in the "AddPlayer" screen to use the new aggregate.

Take a look at the module and let me know if you have any more questions.

ProjectWork.oml

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.