This example highlights the following DBGate features:
Here is an embedded form.
To embed the form, add odatadb.css to the head, odatadb.js at the bottom, and place the control like this:
<div class="dbgate-control" data-url="v4/mssql-041/en-us/usp_order_form"></div>
To try dynamic parameter values, change the category in the first parameter.
You will see the updated value lists in other parameters.
The idea is simple. Just add a parameter to a stored procedure that selects values.
You can find the source codes of the procedures in the code browser below.
Here is the configuration of parameter values.
To test calculated columns, change the amount in any cell.
The trick is in using formula =[@amount]*[@price] in the Total column, defined in the view_items.
You can use a free version of the SaveToDB add-in to convert Excel conditional formatting to such formats.
Use Wizards, Developer Tools, Show Table Format.
And the last exciting thing is protecting cells by the cell change handlers.
Try to delete any name or set the amount in the category line.
The server returns error 500, and DBGate rollbacks the change.
To prevent cell changes, raise an exception. For example, in SQL Server, use RAISERROR (@message, 11, 0).
Here is an SQL definition of the s04.usp_order_form_change procedure used as a handler.
This sample shows how database developers can create interactive web forms.
Just create a cell change handler, procedures to select parameter values, and add the conditional formatting.
Select Excel formulas to have calculated columns and embed the form into any corporate web page.
You can download samples for any supported database platform with the SaveToDB SDK.