Finereport method of interaction between single line and database

Source: Internet
Author: User

1. Description of the problem

When we make a report, we often encounter the need to add action on one line, directly interacting with the database, and executing the stored procedure. We can add a sail soft "insert" button in each line to implement the Insert action, and in the control event to increase the interaction with the database, but when the event is too much when the sail soft can not be stably interactive, there will be data loss or database connection errors and other issues. Therefore, this document describes a single-line data and database interaction method

2. Realization of Ideas

In the design of the sail soft report, through the template---report property implementation and database interaction is the conventional means, and process stability is not prone to error. Therefore, the use of the button event to write the JS event, call the completion of the property, and use the conditions to limit the inbound data to achieve a single-line reporting.

3. Example

We assume that the product stock is in-hand, and then apply for the order to subtract the ordered quantity from the inventory, and after each row of data into the database, you can see the change of inventory quantity

3.1 Open a report

3.2 Edit JS statement record order product name

Right-click Product Name--Control Settings--event editor--new event--edit end. Write the JS statement, Contentpane.setcellvalue ("G1", Null,this.getvalue ()); A new record is added to the G1 cell.

3.3 Call fill function, set conditions

Template--reporting properties--built-in sql--> commit type Select Smart Commit, corresponding to the fields and cell one by one that will be submitted in the submission.

Filter by verifying that the data you added is up-to-date. Note that cell G1 must be set as a text control

3.4 Edit Add button, invoke fill event

Adds a button control to the second-to-last cell and sets the icon and type of the control. Note that all cells are set to the downward direction of the extension, and the cell insert row policy with the SQL statement is the original value, and the corresponding expansion cell for the button is B3.

Edit the button for events, click-to-write the JS statement: _g (). Writereport (); Call fill function.

3.5 Save and preview

Save the template, click the Fill Preview, the effect is as follows

You can see the inventory changes (here is the demo database, cannot add new fields, the reader in the actual use of the database can be added a field, specifically to store the original inventory, in order to make the page beautiful, you can hide the H column

Finereport method of interaction between single line and database

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.