ODataDB Sample 17 - Budget Request

This example demonstrates how to create forms for budget requests.

Budget Request Sample

Expanded Rows and Fixed Row Order

The s17.usp_request procedure has the @rows parameter, which returns the required number of rows. Check out the procedure source code.

The form utilizes the DoNotSort handler to prevent row sorting.

To maintain the user's row order, the s17.usp_request_insert and s17.usp_request_update procedures use the @row_index and @rownum parameters.

The @row_index parameter retrieves its value from the row_index column, which is standard practice.

The @rownum parameter has a unique meaning in ODataDB, as it passes the actual row number.

When a user deletes or inserts a row, ODataDB updates the row indexes for all rows below the affected row.

Saving Changes

The s17.usp_request procedure includes methods to save changes: s17.usp_request_insert, s17.usp_request_update, and s17.usp_request_delete.

ODataDB automatically detects these procedures, so no additional configuration is needed.

As mentioned earlier, these procedures utilize the special @rownum parameter.

They also use a special @transaction_start_time parameter that indicates the start time of the transaction.

Parameter and Cell Drop-down Values

This sample retrieves values from tables configured in the xls.handlers table. Refer to the ParameterValues and ValidationList handlers for details.

Developers can also specify stored procedures or views as needed.

Check the $metadata for more information.

Default Values

This sample includes constant default values configured in the xls.handlers table.

You can generate default values based on the current user as well.

Default and Conditional Formatting

This sample employs two types of formatting rules:

You can use the SaveToDB add-in to save Excel table formats via the Save, Save Table Format menu item.

ODataDB loads Excel formats only for the first connection, hiding hidden columns and setting column number formats.

For the second type of format, the ODataDB client loads these formats every time.

A free version of the SaveToDB add-in can convert Excel conditional formatting to these formats. Use Wizards, Developer Tools, and Show Table Format.

Calculated Columns

This form includes a total column calculated using a formula defined in the s17.usp_request procedure.

Note that ODataDB supports Excel formulas that utilize column names and JavaScript-compatible operators.

Embedding Forms

To embed the form, include db.css in the head, db.js at the bottom, and place the control as follows:

<div class="db-control" data-app="odatadb" data-url="v4/mssql-171/default/en-us/usp_request()"></div>

Conclusion

ODataDB offers a wide range of features. Feel free to reach out for assistance.

Code Browser



You can download samples for any supported database platform with the SaveToDB SDK.