...
You can now test the queries by opening a new browser tab and using the Database URL http://localhost:8082/database/products/allProducts?pline=Ships. Note the URL parameter ?pline=, which is required to provide a value in the WHERE condition of your SQL statement. You should see the xml results of this query in your browser. If you do not, please check out the Troubleshooting section for possible reasons.
Generate a Schema
Next, we will generate a schema from this query, which will allow our frevvo form to automatically create controls for us, and recognize those controls as connected to our database. Of course, you can create controls from the palette, but with large amounts of data/columns/tables, most customers find it much faster to create the form from schema.
It's easy to generate the schema. Go to the browser tab where you just tested your query URL http://localhost:8082/database/products/allProducts?pline=Ships
. Now edit the URL and add /schema after allProducts but before the ?pline= parameter. Your URL will look like this: http://localhost:8082/database/products/allProducts/schema?pline=Ships
. The results should now show in xsd format, which frevvo can translate into form controls.
Right-click anywhere in the window and save the page as an xsd file. Name it anything you want, i.e. allProduct.xsd. We'll use this file in the Upload the Schema step below.
Create a URL to Fetch Dropdown Options
...
- Log into frevvo as the designer user.
- Navigate to the Project where you will create your form (or create a new Project.)
- Click the Schemas tab.
- Click the blue plus icon to add a new schema.
- Provide a name and description and upload the allproducts.xsd file you saved earlier.
- Click Upload
Create the Form
...
You could test your form now, and see that the dropdown contains all the product lines from your database table productlines.
Table from Schema
Next, we'll add the table that will show you all the products in a given product line, just like the query we tested earlier (but in a much friendlier layout for your users!)
- On the Data Sources tab, click New from XSD.
- Expand the allProducts line, which represents your schema, and then click the green plus icon to add the allProducts query elements to your Data Sources tab.
- In the Data Sources tab, click the green plus beside the newly-added allProducts element. Notice that a Section control named All Products, with a Repeat control inside it, gets automatically added to the top of your form.
- We'll customize these controls so they look nice for our users.
- Drag and drop the All Products section below your dropdown control.
- Change the label of the All Products section to give the user some context about which product line is being queried. We'll use the control template {pl}, which at run-time will display the value selected from the dropdown. The new label is 'All Products in {pl=Product Line}'.
- Click the Repeat control (the carbon copy icon ). Change the Control Type from Repeat to Table. If you plan to at some point use business rules to customize the behavior of this table, you can also give it a more meaningful name, however, that is not required for this example.
- Notice that your table has columns corresponding to your database columns. If desired, you can make further customizations to the table, such as modifying the column widths, labels, etc. See this documentation for changes you can make to controls from schema.
...