Salesforce

How Do I Implement a Choice Control Whose Data Comes from a Database Table? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Implement a Choice Control Whose Data Comes from a Database Table? (Magic xpa 3.x)

Often it is useful to have a control where the data is chosen from a database table. That way, when the choices change because of table updates, the choices change automatically also.

In this example, we are choosing a studio from the studio table. While the user sees only the studio name, the studio code is what is brought back into the task. Let’s see how to do it.

Creating a choice control tied to a database table

  1. First, create the virtual that will hold the data. In our example, that is v.Studio Code.

  2. Drag the Combo Box (or other choice control) from the Toolbox and drop it onto your form.

  3. Select the virtual for the Data property of the choice control (L, in our example).

  4. Zoom from the Source table property to select the table you want to use. In our example that is Studios.

  5. Zoom from the Display field property to select the field you want to show to the user. In our example, we used Studio Name.

  6. Zoom from the Linked field property to select the field you want brought back in to the virtual. In our example, that is the Studio code field.

  7. Zoom from the Index property to select the display order of the fields. If you are using Field ranges, it is important that the index match the range, or you will have performance problems. For instance, you don’t want to have the index search the table by Studio code, while your field range is filtering by Zip code.

  8. Zoom from Field ranges to limit the number of entries in the choice control, if applicable. For instance, we might want only the Studios that are located in California.

Now, when the task is run, the choice control will be populated by live data from the table.

Note: If the table is large, using the table in a choice control can present a performance issue. This option is best used for smaller tables, or tables where there are good efficient indexes. Also, note that the tables used in choice controls do not show up on the declared tables list.

See also

The Online and Rich Client Samples projects (program HG21 and RHG21)

Reference
Attachment 
Attachment