Recent News
|
InnPlanner 2010 Released
New faster database engine, more customization features, weekly tariffs, full multi-user work support and much more...
| |
InnPlanner 2010 RC1
InnPlanner 2010 Release Candidate 1 is ready for downloading and testing. You can download it from the "Downloads" section.
|
|
|
Hotel Software Documentation
Using forms for entering variables
Using forms for entering variables |
Introduction
Forms can be used not only for data storage, but as well for entering variables and using them afterwards in scripts.
Using forms for entering data, it is possible to enter several values in a convenient form.
Description
Any form can be used as a form for data entry. For example, let's create a form with three fields and name it as Form1:
The fields are of following types: simple text field, date field, many-to-many relational field. If the database has no other forms, the created form may be indicated as a reference form for many-to-many relational field.
Now, let's create a toolbar button, by clicking on which, a data entry form will be shown.
- Open the Toolbar Editor and create a new button.
- In the opened script editor, click on the Add Variable button and choose
Set Vars By Form option from the menu.
- This action will show you a form, and after the data entry will create variables, the names of which consist of two parts:
user-set prefixes and field name. If we choose "var_" prefix, than in our example the following variables will be created: var_title, var_date, var_notes, var_notes_sel, var_. The origin of the two latest variables will be covered later. So, set up the following input parameters:
- Prefix: var_
- Form: form1
- Form title text: Testing Form Input.
-
Add one more script line in order to show entered values:
Run the script and enter the following data:
Click Ok. The variables will be created within the script, and you shall see the following message:
[$var_notes] variable is a recordset, with relational field entries.
[$var_notes_sel] variable is a recordset with entries selected at the moment of the click on the OK button. Recordset variables can be used for instance for operations in a recordset. To learn more, see Usage of RecordSet Variables section.
The variable with the name of selected prefix ([$var_]) is equal to "1" in case the user have clicked Ok. It is empty if the user clicked Cancel or just closed the window.
Pre-check of entered data
It is possible to add a pre-check of entered data in the form editor.
- Open the form editor, choose a form for a data entry, and go to Scripts and Behaviour tab.
- Set On Confirm option equal to Execute Script:
- To cancel data entry using the script, if it happens that the used did not fill the form correctly, set [$cancel] variable equal to 1.
Let's check a script to verify a Title field entry:
- Save the script, close the script editor. Click on the toolbar button to open an input window. Leaving the field empty, click Ok. If the script is composed correctly, you shall se a warning about incorrect data entry, and the window shall resume opened:
On Confirm verification script is also executed on creating a new record with the help of the popup form.
See Also:
Variables
Text/Math/Date Variables
Script Designer
List of actions
|
|
|
|
Today"s Poll
What software do use for your inn/b&b/hotel/etc?
|