Example: Populate a browse using a freeform query
- Last Updated: April 8, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
To populate a browse from the AppBuilder using a
Freeform query:
- Open the AppBuilder and select to create a new window.
- In the Section Editor of the new window, select
Definitions from the Section
drop-down list, and write the code for the temp table definition. For example,
to create a temp table named
ttStateusing theStatetable from theSports2020database, write the following code:DEFINE TEMP-TABLE ttState LIKE State. - From the Palette, select Browse,
and drop it in the
window.
You are prompted to connect to a database to create the browse.
- In the Query Builder dialog box, select the Freeform
Query button.Note: Select Freeform. Allow freeform editing of query. in the Progress Advisor dialog box if it appears, and click OK.
- From the Palette, select the Button object and drop it in the window.
- In the Section Editor of the Button object,
select Triggers from the Section
drop-down list, and write the following code for the
CHOOSE event:
DO: {&SELF-NAME}:SENSITIVE = FALSE. FOR EACH state : CREATE ttState. ASSIGN ttState.State = State.state ttState.statename = state.statename ttState.region = state.region. END. OPEN QUERY <browse-object-name> FOR EACH ttState. END.Note: The <browse-object-name> is the name of the browse that is displayed in the Object field on the AppBuilder toolbar. You can also provide a user-defined name to the browse in the Object field of the Property Sheet. The Property Sheet appears by double-clicking the browse object in the window.For more information on browse attributes, see Property Sheet for Browse.
- In the Section Editor of the
Browse, select Triggers from
the Section drop-down list, and write the code for the
following events:
- OPEN_QUERY:
OPEN QUERY <browse-object-name> FOR EACH ttState. - DISPLAY:
State StateName Region
- OPEN_QUERY:
- Save the window and select from the AppBuilder toolbar to execute the window.
- Click the Button object to populate the Browse
on the
window.
The Browse object populates with data from the
Close the window to terminate the application.Statetable.