...
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.
...
- Drag and drop a Dropdown control to you form.
- Label "Select Product Line"
- Name "pl"
- Change the Options Src property to Web Service.
- Set the Options Url property to the URL you generated earlier. In our example this URL is
http://localhost:8082/database/products/productlines?_mediaType=json
- The Value Binding and Label Binding properties set the options syntax value=label. In this case they are both the same, the column name productLine. When using json data, we'll prepend that column name with /resultSet/.
- Value Binding: /resultSet/productLine
- Label Binding: /resultSet/productLine
...
- Go to Settings editing mode.
- Select the Document Actions tab, and then the Send Data Sub-tab.
- Select the option Manually Set Doc URls.
- On the Document: allProducts (the one you pulled in as a Data Source) we will set a Read URL with the method GET, which will map to the SELECT statement in our query, and a Write URL with the method PUT, which will map to the UPDATE, CREATE, and DELETE statements. These URLs are constructed similarly to the browser test URL.
- Read URL:
http://localhost:8082/database/products/allProducts?pline={pl!encode=true}
- This URL point to the location of the database connector, the queryset name, and the query name with the parameter ?pline= that meets the WHERE condition of the SELECT statement.
- The template {pl} will resolve to the value of the dropdown in our form, which will be a valid productLine result since the options are populated dynamically from our database.
- Notice that we've added the syntax !encode=true inside the template. Since some of the productLines contain spaces, and a valid URL cannot contain a space, this will ensure that the spaces are encoded correctly. It's a good idea to encode templates used in URLs when the value might contain spaces or special characters.
- Read URL Method: GET.
Write URL:
http://localhost:8082/database/products/allProducts?pline={pl!encode=true}
Info If your SELECT statement does not include a WHERE condition, and/or if you are only performing CREATE/UPDATE operations, you do not need the parameter ?pline= on this URL. However, when the SELECT statement is in the same query and uses a WHERE condition, and you need to perform DELETE operations, you must include the parameter on the Write URL as well. https://frevvoit.atlassian.net/browse/TIP-28509
- Write URL Method: PUT. The PUT method, which typically maps to UPDATE statements, will also perform CREATE and DELETE statements as long as the query contains the attributes autocreate="true", autodelete="true" and deleteKey="productCode" (replace with your table's unique key).
- Read URL:
...