About    Download    Order    Support


InnPlanner Reservation Software Videos

About
Download
Order/Prices
Support/Contact
Partner Program
Press Room
Online Help


Recent News

InnPlanner 2010 Released
New faster database engine, more customization features, weekly tariffs, full multi-user work support and much more...

2010 Feb 10

InnPlanner 2010 RC1
InnPlanner 2010 Release Candidate 1 is ready for downloading and testing. You can download it from the "Downloads" section.

2010 Jan 14


Hotel Software Documentation

User Functions

User Functions

Introduction

A User Function is a script that can be executed from other scripts. For example, if you use a set of actions in several scripts, you can create a User Function containing these actions and call this function when you need.

User Functions can accept arguments and return the result of their work to a specified variable.

For example, you can create User Function that calculates a complicated formula basing on some input data and returns the result to a variable. You can also record specified values to specified fields of a selected database record.

Using User Functions

Here is an example of simplifying the script described in the Script Designer using a User Function:

First the script asks the user to enter the value of the [$quantity] variable that should exceed 0, then it increases the value of the [Order Total] field of the current folder by the entered value.

Let's replace this part of the script with a User Function:

Creating a New User Function

To create a new User Function click User Functions->Create New... or right-click the User Functions tree and select Create New...:

   

Enter the name of the new User Function. For example, ChangeQuantity.

Click Ok to open the User Functions editor:

Editing User Functions

Editing a script in User Functions is similar to editing an ordinary script. See the Script Designer Help Section for more information.

As noted above, a User Function can accept arguments and return values to a variable. To set a User Function click the UF Setup... button or click User Function Properties... in the menu:

   

User Function Properties

  • Name - specify the function name;
  • Argument Name (1, 2, 3) - specify names of arguments where input variables will be recorded;
  • Description (1, 2, 3) - argument description;
  • Function returns value) - select this checkbox if you want the function to return its value. You can use the text box on the right to describe the value.

If you change User Function properties as shown on the illustration, predefined variables will appear in the script tree of the UF editor:

You should record the result of the User Function to the [$result] variable in the end of the script.

We'll create a User Function using these variables:

Click Ok to save the User Function.

Inserting a User Function to a script

To call a User Function from a script, click User Functions->Insert... or double-click the required function in the function tree.

A standard Select Action dialog box will open:

In the dialog box we can set values of the User Function (default, text) and specify the variable where the action result will be saved ([$new_total]).

Thus, the script containing a User Function will look like this:

  • In line 2 we call the ChangeQuantity user function and record its result to the [$new_total] variable.
  • Line 3 shows the value of the [$new_total] variable.

Changing Many Records with User Function

This way of modifying records is obsolete. It is much more convenient to modify record in cycles. Know more...

You can apply a User Function to several records (a set of records). For example, you can change the value of record fields, e-mail a record, etc.

Let's take the ChangeQuantity User Function described above. To perform an action with a recordset we should do the following:

The script for changing several records looks like this:


See Also:

Script Designer

Using Variables

Action Editor

List of actions

Text Formulas




Today"s Poll

What software do use for your inn/b&b/hotel/etc?

Do not use
Inn Planner
Access, Excel
ASSD
Auberge
Digitalrez
Easy Inn Keeping
EnSuite HR
GuestMaster
iMagic HR
Smart FX
Other