Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

...

  1. Drag and drop a Dropdown control to you form. 
    1. Label "Select Product Line"
    2. Name "pl"
  2. Change the Options Src property to Web Service.
  3. 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
  4. 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/.
    1. Value Binding: /resultSet/productLine
    2. Label Binding: /resultSet/productLine

...

  1. Go to Settings editing mode. 
  2. Select the Document Actions tab, and then the Send Data Sub-tab.
  3. Select the option Manually Set Doc URls.
  4. 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.
    1. Read URLhttp://localhost:8082/database/products/allProducts?pline={pl!encode=true}
      1. 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.
      2. 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.
      3. 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.
    2. Read URL Method: GET.
    3. Write URLhttp://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

    4. 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).

...