I. Overview
1. Problem description
In the filling template, you often encounter general verification, which may not meet your needs.
For example, when a user changes his password, he should first enter the original password, which should be verified with the corresponding value (original password) in the database. If it is the same, it will be updated, if it is different, an error will be reported. As shown in the figure below:
2. Implementation ideas
Add built-in verification and use formula to verify cells.
II. Steps
1. Report design
As shown in the figure below, add password widgets to cells B2 and B3.
2. Data entry attribute setting
In the menu bar, click Template > Data entry attributes to add built-in SQL submission. The database is FRdemo and the table is userinfo. Smart add username and password, and the values are parameter $fine_username and B3, check username as the primary key, as shown in the figure below:
Note: parameter $fine_ username is used to modify the password, and its specific application can refer to theParameter control of Permission granularity
3. Data validation settings
In the menu bar, click Template > Data entery Attributes to add a built-in verification for data validation. As shown in the figure below:
Validation formula: B2==sql("FRDemo","select * from userinfo where information_username='"+$fine_username+"'",3)
Validation error information: "Wrong Password,cannot be modified!"
Note: the meaning of the verification formula is to query the password corresponding to the user name in the userinfo table. For a detailed explanation of the formula, see the SQL function in the document
Meaning of verification: the data in B2 must be the same as the password of the current user, if not, an error will be reported.
Note: this example only shows how to check the data in the cell and the data in the database. You can also set other check settings for the cell.
4. Report Preview
Mount the template to the decision-making system. The preview method is data entry. For the mounting method, please refer to the document: Decision System Mount Report, log in to the decision-making system with Anna's account, and open the template.
Anna's password in the userinfo table is 123456.
When the input old password is not 123456, the data validation prompt: "Wrong Password,cannot be modified!"
When the old password is 123456, the data verification prompts: verification is successful,
as shown in the figure below:
III. Template download
Completed template, please refer to %fr_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\DataEntry\DataEntryAttribute\PassVerify.cpt
Click download template: