This example highlights the following ODataDB features:
Here is an embedded form.
To embed the form, add db.css to the head, db.js at the bottom, and place the control like this:
<div class="db-control" data-app="odatadb" data-url="v4/mssql-041/default/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.
ODataDB supports Excel formulas that use column names and JavaScript-supported operators.
This sample loads formatting rules from the xls.handlers table.
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 ODataDB 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.
© 2019-2024 Gartle LLC | www.savetodb.com | ODataDB Guide | Developer Guide | Privacy Policy | Cookie Policy